fix: fix when creating HMAC jwts invoke #keyPair

This commit is contained in:
zihluwang
2024-09-15 09:41:23 +08:00
parent a9f75fbacc
commit 469204c18c
@@ -93,10 +93,10 @@ public class AuthzeroTokenResolverAutoConfiguration {
public TokenResolver<DecodedJWT> tokenResolver() { public TokenResolver<DecodedJWT> tokenResolver() {
var builder = AuthzeroTokenResolver.builder(); var builder = AuthzeroTokenResolver.builder();
if (TokenAlgorithm.HMAC_ALGORITHMS.contains(simpleJwtProperties.getAlgorithm())) { if (TokenAlgorithm.ECDSA_ALGORITHMS.contains(simpleJwtProperties.getAlgorithm())) {
builder.keyPair(simpleJwtProperties.getPublicKey(), simpleJwtProperties.getPrivateKey()) builder.keyPair(simpleJwtProperties.getPublicKey(), simpleJwtProperties.getPrivateKey())
.algorithm(simpleJwtProperties.getAlgorithm()); .algorithm(simpleJwtProperties.getAlgorithm());
} else if (TokenAlgorithm.ECDSA_ALGORITHMS.contains(simpleJwtProperties.getAlgorithm())) { } else if (TokenAlgorithm.HMAC_ALGORITHMS.contains(simpleJwtProperties.getAlgorithm())) {
builder.secret(simpleJwtProperties.getSecret()) builder.secret(simpleJwtProperties.getSecret())
.algorithm(simpleJwtProperties.getAlgorithm()); .algorithm(simpleJwtProperties.getAlgorithm());
} }