summaryrefslogtreecommitdiffstats
path: root/jrt/tests
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahooinc.com>2022-07-13 16:53:43 +0200
committerBjørn Christian Seime <bjorncs@yahooinc.com>2022-07-15 15:35:10 +0200
commiteed3e5deaf3fd13c353361e45420735a93d0f3d0 (patch)
treeb4e738c5cf85775153237ec07ea08f4e97d224f1 /jrt/tests
parentff26daaf31ec0567dc6a9049d5e275cf7c4810dc (diff)
Return granted capabilities from PeerAuthorizer
Introduce new ConnectionAuthContext as replacement for AuthorizationResult/SecurityContext.
Diffstat (limited to 'jrt/tests')
-rw-r--r--jrt/tests/com/yahoo/jrt/EchoTest.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/jrt/tests/com/yahoo/jrt/EchoTest.java b/jrt/tests/com/yahoo/jrt/EchoTest.java
index 26d4315fad6..7213068c0f9 100644
--- a/jrt/tests/com/yahoo/jrt/EchoTest.java
+++ b/jrt/tests/com/yahoo/jrt/EchoTest.java
@@ -2,6 +2,7 @@
package com.yahoo.jrt;
+import com.yahoo.security.tls.authz.ConnectionAuthContext;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
@@ -28,19 +29,19 @@ public class EchoTest {
Supervisor client;
Target target;
Values refValues;
- SecurityContext securityContext;
+ ConnectionAuthContext connAuthCtx;
private interface MetricsAssertions {
void assertMetrics(TransportMetrics.Snapshot snapshot) throws AssertionError;
}
- private interface SecurityContextAssertion {
- void assertSecurityContext(SecurityContext securityContext) throws AssertionError;
+ private interface ConnectionAuthContextAssertion {
+ void assertConnectionAuthContext(ConnectionAuthContext authContext) throws AssertionError;
}
@Parameter(value = 0) public CryptoEngine crypto;
@Parameter(value = 1) public MetricsAssertions metricsAssertions;
- @Parameter(value = 2) public SecurityContextAssertion securityContextAssertion;
+ @Parameter(value = 2) public ConnectionAuthContextAssertion connAuthCtxAssertion;
@Parameters(name = "{0}") public static Object[] engines() {
@@ -62,8 +63,8 @@ public class EchoTest {
assertEquals(1, metrics.serverTlsConnectionsEstablished());
assertEquals(1, metrics.clientTlsConnectionsEstablished());
},
- (SecurityContextAssertion) context -> {
- List<X509Certificate> chain = context.peerCertificateChain();
+ (ConnectionAuthContextAssertion) context -> {
+ List<X509Certificate> chain = context.peerCertificate();
assertEquals(1, chain.size());
assertEquals(CryptoUtils.certificate, chain.get(0));
}},
@@ -80,8 +81,8 @@ public class EchoTest {
assertEquals(1, metrics.serverTlsConnectionsEstablished());
assertEquals(1, metrics.clientTlsConnectionsEstablished());
},
- (SecurityContextAssertion) context -> {
- List<X509Certificate> chain = context.peerCertificateChain();
+ (ConnectionAuthContextAssertion) context -> {
+ List<X509Certificate> chain = context.peerCertificate();
assertEquals(1, chain.size());
assertEquals(CryptoUtils.certificate, chain.get(0));
}}};
@@ -146,7 +147,7 @@ public class EchoTest {
for (int i = 0; i < p.size(); i++) {
r.add(p.get(i));
}
- securityContext = req.target().getSecurityContext().orElse(null);
+ connAuthCtx = req.target().getConnectionAuthContext().orElse(null);
}
@org.junit.Test
@@ -164,11 +165,11 @@ public class EchoTest {
if (metricsAssertions != null) {
metricsAssertions.assertMetrics(metrics.snapshot().changesSince(startSnapshot));
}
- if (securityContextAssertion != null) {
- assertNotNull(securityContext);
- securityContextAssertion.assertSecurityContext(securityContext);
+ if (connAuthCtxAssertion != null) {
+ assertNotNull(connAuthCtx);
+ connAuthCtxAssertion.assertConnectionAuthContext(connAuthCtx);
} else {
- assertNull(securityContext);
+ assertNull(connAuthCtx);
}
}
}