Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix IllegalArgumentException when using EdDSA signature algorithm
This fixes `java.lang.IllegalArgumentException: No enum constant io.smallrye.jwt.algorithm.SignatureAlgorithm.EdDSA` when `EDDSA` is set through `smallrye.jwt.new-token.signature-algorithm` property, or when it is set with `JwtClaimsBuilderImpl`. Currently, `JwtSignatureImpl.getConfiguredSignatureAlgorithm()` returns algorithm name as a String from `SignatureAlgorithm.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 means `EdDSA`, because this is how `JwtClaimsBuilderImpl` puts the value there. This name is then used to get appropriate `SignatureAlgorithm` enum variant in `JwtSignatureImpl.getSigningKeyFromKeyContent(String)`, but without using `toUpperCase()` on the name, causing exception when `EdDSA` is used. The fix adds `toUpperCase()` call on algorithm name before passing it to `SignatureAlgorithm.valueOf(String)`.
- Loading branch information