Skip to content

Commit 7905dd2

Browse files
authored
Fix JwtProvider wrong error message for Helidon 3.x (helidon-io#4136)
* Fix Error Message * Fix copyright * Fix verification comment * Applied suggestion
1 parent 7de5c71 commit 7905dd2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • security/providers/jwt/src/main/java/io/helidon/security/providers/jwt

security/providers/jwt/src/main/java/io/helidon/security/providers/jwt/JwtProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2021 Oracle and/or its affiliates.
2+
* Copyright (c) 2018, 2022 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -169,12 +169,12 @@ private AuthenticationResponse authenticateToken(String token) {
169169
Errors errors = signedJwt.verifySignature(verifyKeys, defaultJwk);
170170
if (errors.isValid()) {
171171
Jwt jwt = signedJwt.getJwt();
172-
// verify the audience is correct
172+
// perform all validations, including expected audience verification
173173
Errors validate = jwt.validate(null, expectedAudience);
174174
if (validate.isValid()) {
175175
return AuthenticationResponse.success(buildSubject(jwt, signedJwt));
176176
} else {
177-
return failOrAbstain("Audience is invalid or missing: " + expectedAudience);
177+
return failOrAbstain(validate.toString());
178178
}
179179
} else {
180180
return failOrAbstain(errors.toString());

0 commit comments

Comments
 (0)