diff --git a/src/main/java/com/amazon/dlic/auth/http/jwt/HTTPJwtAuthenticator.java b/src/main/java/com/amazon/dlic/auth/http/jwt/HTTPJwtAuthenticator.java index 467bb68760..1266bc8b04 100644 --- a/src/main/java/com/amazon/dlic/auth/http/jwt/HTTPJwtAuthenticator.java +++ b/src/main/java/com/amazon/dlic/auth/http/jwt/HTTPJwtAuthenticator.java @@ -69,29 +69,23 @@ public HTTPJwtAuthenticator(final Settings settings, final Path configPath) { requireAudience = settings.get("required_audience"); requireIssuer = settings.get("required_issuer"); - JwtParserBuilder jwtParserBuilder = KeyUtils.createJwtParserBuilderFromSigningKey(signingKey, log); + final JwtParserBuilder jwtParserBuilder = KeyUtils.createJwtParserBuilderFromSigningKey(signingKey, log); if (jwtParserBuilder == null) { jwtParser = null; } else { if (requireAudience != null) { - jwtParserBuilder = jwtParserBuilder.require("aud", requireAudience); + jwtParserBuilder.requireAudience(requireAudience); } if (requireIssuer != null) { - jwtParserBuilder = jwtParserBuilder.require("iss", requireIssuer); + jwtParserBuilder.requireIssuer(requireIssuer); } final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new SpecialPermission()); } - JwtParserBuilder finalJwtParserBuilder = jwtParserBuilder; - jwtParser = AccessController.doPrivileged(new PrivilegedAction() { - @Override - public JwtParser run() { - return finalJwtParserBuilder.build(); - } - }); + jwtParser = AccessController.doPrivileged((PrivilegedAction) jwtParserBuilder::build); } }