public final class NimbusJwsEncoder extends Object implements JwtEncoder
JwtEncoder
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 obtained from the KeyManager
supplied via the constructor. NOTE: This implementation uses the Nimbus JOSE + JWT SDK.
JwtEncoder
, KeyManager
, JSON Web Token (JWT), JSON Web Signature (JWS), JWS Compact Serialization, Nimbus JOSE + JWT SDKConstructor and Description |
---|
NimbusJwsEncoder(KeyManager keyManager) Constructs a NimbusJwsEncoder using the provided parameters. |
Modifier and Type | Method and Description |
---|---|
Jwt | encode(JoseHeader headers, JwtClaimsSet claims) Encode the JWT to it's compact claims representation format. |
public NimbusJwsEncoder(KeyManager keyManager)
NimbusJwsEncoder
using the provided parameters.keyManager
- the key managerpublic Jwt encode(JoseHeader headers, JwtClaimsSet claims) throws JwtEncodingException
JwtEncoder
encode
in interface JwtEncoder
headers
- the JOSE headerclaims
- the JWT Claims SetJwt
JwtEncodingException
- if an error occurs while attempting to encode the JWT