Closed 0rzech closed 5 months ago
It is also possible to call toUpperCase()
here, but it would make algorithm naming lax everywyhere, as SignatureAlgorithm.fromAlgorithm(String)
is also used here.
Alternatively, EDDSA("EdDSA")
could be changed to EDDSA("EDDSA")
here, because the public interface seems to expect all letters to be upper case when using builder anyway, so the change should not be breaking.
Closing in favour of #800 .
This fixes
java.lang.IllegalArgumentException: No enum constant io.smallrye.jwt.algorithm.SignatureAlgorithm.EdDSA
whenEDDSA
is set throughsmallrye.jwt.new-token.signature-algorithm
property, or when it is set withJwtClaimsBuilderImpl
.Currently,
JwtSignatureImpl.getConfiguredSignatureAlgorithm()
returns algorithm name as a String fromSignatureAlgorithm.algorithmName
field, in case of it being loaded from a configuration file.If the algorithm was set through
JwtClaimsBuilderImpl
, the value is returned as-is from the header, which meansEdDSA
, because this is howJwtClaimsBuilderImpl
puts the value there.This name is then used to get appropriate
SignatureAlgorithm
enum variant inJwtSignatureImpl.getSigningKeyFromKeyContent(String)
, but without usingtoUpperCase()
on the name, causing exception whenEdDSA
is used.The fix adds
toUpperCase()
call on algorithm name before passing it toSignatureAlgorithm.fromAlgorithm(String)
.