Class JWTTransferCartTokenEncoder
java.lang.Object
com.broadleafcommerce.cartoperation.service.csr.JWTTransferCartTokenEncoder
- All Implemented Interfaces:
TransferCartTokenEncoder
A default implementation of the
TransferCartTokenEncoder
that encodes the
TransferCartToken
into a JWT token string.-
Constructor Summary
ConstructorsConstructorDescriptionOptional constructor if looking to manually configure the encoder using the setters.Primary constructor for initializing the encoder -
Method Summary
Modifier and TypeMethodDescriptionencode
(TransferCartToken transferCartToken) Encodes a token from theTransferCartToken
and should return the same object with `token` property containing the encoded token string.protected com.nimbusds.jwt.JWTClaimsSet
getClaims
(TransferCartToken transferCartToken) protected Date
protected JWTTransferCartTokenEncoderProperties
protected com.nimbusds.jose.JWSSigner
void
setEncodedPrivateKey
(String encodedPrivateKey) Sets the value ofJWTTransferCartTokenEncoderProperties.getEncodedPrivateKey()
, and initializes thesigner
used to sign JWT tokens.void
setExpirationTimeout
(Duration expirationTimeout) Setter for overwriting the current expiration time forJWTTransferCartTokenEncoderProperties
.void
Setter for overwriting the current issuer forJWTTransferCartTokenEncoderProperties
.
-
Constructor Details
-
JWTTransferCartTokenEncoder
Primary constructor for initializing the encoder- Parameters:
properties
- the property configuration for the encoder
-
JWTTransferCartTokenEncoder
public JWTTransferCartTokenEncoder()Optional constructor if looking to manually configure the encoder using the setters.
-
-
Method Details
-
setEncodedPrivateKey
Sets the value ofJWTTransferCartTokenEncoderProperties.getEncodedPrivateKey()
, and initializes thesigner
used to sign JWT tokens.- Parameters:
encodedPrivateKey
- the encoded private key
-
setIssuer
Setter for overwriting the current issuer forJWTTransferCartTokenEncoderProperties
.- Parameters:
issuer
- the issuer
-
setExpirationTimeout
Setter for overwriting the current expiration time forJWTTransferCartTokenEncoderProperties
.- Parameters:
expirationTimeout
- the expiration timeout duration
-
encode
public TransferCartToken encode(TransferCartToken transferCartToken) throws TransferCartTokenEncoderException Description copied from interface:TransferCartTokenEncoder
Encodes a token from theTransferCartToken
and should return the same object with `token` property containing the encoded token string.- Specified by:
encode
in interfaceTransferCartTokenEncoder
- Parameters:
transferCartToken
- the transfer cart token without an encoded token string- Returns:
- the transfer cart token with an encoded token string
- Throws:
TransferCartTokenEncoderException
- when it fails to encode the token
-
getClaims
-
getExpirationTime
-
getProperties
-
getSigner
protected com.nimbusds.jose.JWSSigner getSigner()
-