File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
security/providers/jwt/src/main/java/io/helidon/security/providers/jwt Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -168,12 +168,14 @@ private AuthenticationResponse authenticateToken(String token) {
168168 if (errors .isValid ()) {
169169 Jwt jwt = signedJwt .getJwt ();
170170 // perform all validations, including expected audience verification
171- JwtValidator jwtValidator = JwtValidator .builder ()
171+ JwtValidator . Builder jwtValidatorBuilder = JwtValidator .builder ()
172172 .addDefaultTimeValidators ()
173173 .addCriticalValidator ()
174- .addUserPrincipalValidator ()
175- .addAudienceValidator (expectedAudience )
176- .build ();
174+ .addUserPrincipalValidator ();
175+ if (expectedAudience != null ) {
176+ jwtValidatorBuilder .addAudienceValidator (expectedAudience );
177+ }
178+ JwtValidator jwtValidator = jwtValidatorBuilder .build ();
177179 Errors validate = jwtValidator .validate (jwt );
178180 if (validate .isValid ()) {
179181 return AuthenticationResponse .success (buildSubject (jwt , signedJwt ));
You can’t perform that action at this time.
0 commit comments