style(simple-jwt): Upgraded method to get Algorithm declared in third-party implementation.

This commit is contained in:
Zihlu Wang
2023-08-03 18:59:11 +08:00
parent c53124bb61
commit 14450b6489
3 changed files with 7 additions and 8 deletions
@@ -140,7 +140,7 @@ public class AuthzeroTokenResolver implements TokenResolver<DecodedJWT> {
throw new IllegalArgumentException("A secret is required to build a JSON Web Token.");
}
this.jtiCreator = jtiCreator;
this.algorithm = AuthzeroTokenResolverConfig.getInstance().getFunction(algorithm).apply(secret);
this.algorithm = AuthzeroTokenResolverConfig.getInstance().getAlgorithm(algorithm).apply(secret);
this.issuer = issuer;
this.verifier = JWT.require(this.algorithm).build();
}
@@ -140,7 +140,7 @@ public final class AuthzeroTokenResolverConfig implements TokenResolverConfig<Fu
* implementation
*/
@Override
public Function<String, Algorithm> getFunction(TokenAlgorithm algorithm) {
public Function<String, Algorithm> getAlgorithm(TokenAlgorithm algorithm) {
return Optional.of(SUPPORTED_ALGORITHMS).map((entry) -> entry.get(algorithm))
.orElseThrow(() -> new UnsupportedAlgorithmException("The specified algorithm is not supported yet."));
}