diff options
author | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2022-07-13 17:22:04 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2022-07-15 15:35:10 +0200 |
commit | 64adc479fab2fad65c398e70222f3443b75f9f32 (patch) | |
tree | 614120bdf92ede7f4a26cd449bf27f1591f45843 | |
parent | e69c68a2c4b9b8f8d556f376c8f023f602a95eff (diff) |
Rename 'succeeded' => 'authorized'
4 files changed, 6 insertions, 6 deletions
diff --git a/jrt/src/com/yahoo/jrt/TlsCryptoSocket.java b/jrt/src/com/yahoo/jrt/TlsCryptoSocket.java index 40cb7c3938a..721c7c4d2e7 100644 --- a/jrt/src/com/yahoo/jrt/TlsCryptoSocket.java +++ b/jrt/src/com/yahoo/jrt/TlsCryptoSocket.java @@ -100,7 +100,7 @@ public class TlsCryptoSocket implements CryptoSocket { if (authorizationResult == null) { PeerAuthorizerTrustManager.getAuthorizationResult(sslEngine) // only available during handshake .ifPresent(result -> { - if (!result.succeeded()) { + if (!result.authorized()) { metrics.incrementPeerAuthorizationFailures(); } authorizationResult = result; @@ -144,7 +144,7 @@ public class TlsCryptoSocket implements CryptoSocket { } } catch (SSLHandshakeException e) { // sslEngine.getDelegatedTask().run() and handshakeWrap() may throw SSLHandshakeException, potentially handshakeUnwrap() and sslEngine.beginHandshake() as well. - if (authorizationResult == null || authorizationResult.succeeded()) { // don't include handshake failures due from PeerAuthorizerTrustManager + if (authorizationResult == null || authorizationResult.authorized()) { // don't include handshake failures due from PeerAuthorizerTrustManager metrics.incrementTlsCertificateVerificationFailures(); } throw e; diff --git a/security-utils/src/main/java/com/yahoo/security/tls/authz/ConnectionAuthContext.java b/security-utils/src/main/java/com/yahoo/security/tls/authz/ConnectionAuthContext.java index 18f61fc7aa4..52d838d29ef 100644 --- a/security-utils/src/main/java/com/yahoo/security/tls/authz/ConnectionAuthContext.java +++ b/security-utils/src/main/java/com/yahoo/security/tls/authz/ConnectionAuthContext.java @@ -21,7 +21,7 @@ public record ConnectionAuthContext(List<X509Certificate> peerCertificateChain, matchedPolicies = new TreeSet<>(matchedPolicies); } - public boolean succeeded() { return matchedPolicies.size() > 0; } + public boolean authorized() { return matchedPolicies.size() > 0; } public X509Certificate peerCertificate() { return peerCertificateChain.get(0); } diff --git a/security-utils/src/main/java/com/yahoo/security/tls/authz/PeerAuthorizerTrustManager.java b/security-utils/src/main/java/com/yahoo/security/tls/authz/PeerAuthorizerTrustManager.java index ea920a90c7b..21a089e4295 100644 --- a/security-utils/src/main/java/com/yahoo/security/tls/authz/PeerAuthorizerTrustManager.java +++ b/security-utils/src/main/java/com/yahoo/security/tls/authz/PeerAuthorizerTrustManager.java @@ -113,7 +113,7 @@ public class PeerAuthorizerTrustManager extends X509ExtendedTrustManager { if (sslEngine != null) { // getHandshakeSession() will never return null in this context sslEngine.getHandshakeSession().putValue(HANDSHAKE_SESSION_AUTH_CONTEXT_PROPERTY, result); } - if (result.succeeded()) { + if (result.authorized()) { log.fine(() -> String.format("Verification result: %s", result)); } else { String errorMessage = "Authorization failed: " + createInfoString(certChain[0], authType, isVerifyingClient); diff --git a/security-utils/src/test/java/com/yahoo/security/tls/authz/PeerAuthorizerTest.java b/security-utils/src/test/java/com/yahoo/security/tls/authz/PeerAuthorizerTest.java index a2f27ba42bc..3791aed4155 100644 --- a/security-utils/src/test/java/com/yahoo/security/tls/authz/PeerAuthorizerTest.java +++ b/security-utils/src/test/java/com/yahoo/security/tls/authz/PeerAuthorizerTest.java @@ -158,11 +158,11 @@ public class PeerAuthorizerTest { } private static void assertAuthorized(ConnectionAuthContext result) { - assertTrue(result.succeeded()); + assertTrue(result.authorized()); } private static void assertUnauthorized(ConnectionAuthContext result) { - assertFalse(result.succeeded()); + assertFalse(result.authorized()); } private static void assertCapabiltiesGranted(ConnectionAuthContext ctx, Set<Capability> expected) { |