Class NimbusJwtEncoder.SecretKeyJwtEncoderBuilder
java.lang.Object
org.springframework.security.oauth2.jwt.NimbusJwtEncoder.SecretKeyJwtEncoderBuilder
- Enclosing class:
- NimbusJwtEncoder
A builder for creating
NimbusJwtEncoder
instances configured with a
SecretKey
.- Since:
- 7.0
-
Method Summary
Modifier and TypeMethodDescriptionalgorithm
(MacAlgorithm macAlgorithm) Sets the JWS algorithm to use for signing.build()
Builds theNimbusJwtEncoder
instance.jwkPostProcessor
(Consumer<com.nimbusds.jose.jwk.OctetSequenceKey.Builder> jwkPostProcessor) Post-process theJWK
using the givenConsumer
.
-
Method Details
-
algorithm
Sets the JWS algorithm to use for signing. Defaults toJWSAlgorithm.HS256
. Must be an HMAC-based algorithm (HS256, HS384, or HS512).- Parameters:
macAlgorithm
- theMacAlgorithm
to use- Returns:
- this builder instance for method chaining
-
jwkPostProcessor
public NimbusJwtEncoder.SecretKeyJwtEncoderBuilder jwkPostProcessor(Consumer<com.nimbusds.jose.jwk.OctetSequenceKey.Builder> jwkPostProcessor) Post-process theJWK
using the givenConsumer
. For example, you may use this to override the defaultkid
- Parameters:
jwkPostProcessor
- the post-processor to use- Returns:
- this builder instance for method chaining
-
build
Builds theNimbusJwtEncoder
instance.- Returns:
- the configured
NimbusJwtEncoder
- Throws:
IllegalStateException
- if the configured JWS algorithm is not compatible with aSecretKey
.
-