Class NimbusJwtEncoder
- java.lang.Object
-
- org.springframework.security.oauth2.jwt.NimbusJwtEncoder
-
- All Implemented Interfaces:
JwtEncoder
public final class NimbusJwtEncoder extends java.lang.Object implements JwtEncoder
An implementation of aJwtEncoder
that encodes a JSON Web Token (JWT) using the JSON Web Signature (JWS) Compact Serialization format. The private/secret key used for signing the JWS is supplied by thecom.nimbusds.jose.jwk.source.JWKSource
provided via the constructor.NOTE: This implementation uses the Nimbus JOSE + JWT SDK.
- Since:
- 5.6
- See Also:
JwtEncoder
,JWKSource
,JWK
, JSON Web Token (JWT), JSON Web Signature (JWS), JWS Compact Serialization, Nimbus JOSE + JWT SDK
-
-
Constructor Summary
Constructors Constructor Description NimbusJwtEncoder(com.nimbusds.jose.jwk.source.JWKSource<com.nimbusds.jose.proc.SecurityContext> jwkSource)
Constructs aNimbusJwtEncoder
using the provided parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Jwt
encode(JwtEncoderParameters parameters)
Encode the JWT to it's compact claims representation format.
-
-
-
Method Detail
-
encode
public Jwt encode(JwtEncoderParameters parameters) throws JwtEncodingException
Description copied from interface:JwtEncoder
Encode the JWT to it's compact claims representation format.- Specified by:
encode
in interfaceJwtEncoder
- Parameters:
parameters
- the parameters containing the JOSE header and JWT Claims Set- Returns:
- a
Jwt
- Throws:
JwtEncodingException
- if an error occurs while attempting to encode the JWT
-
-