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 theTransferCartTokenand should return the same object with `token` property containing the encoded token string.protected com.nimbusds.jwt.JWTClaimsSetgetClaims(TransferCartToken transferCartToken) protected Dateprotected JWTTransferCartTokenEncoderPropertiesprotected com.nimbusds.jose.JWSSignervoidsetEncodedPrivateKey(String encodedPrivateKey) Sets the value ofJWTTransferCartTokenEncoderProperties.getEncodedPrivateKey(), and initializes thesignerused to sign JWT tokens.voidsetExpirationTimeout(Duration expirationTimeout) Setter for overwriting the current expiration time forJWTTransferCartTokenEncoderProperties.voidSetter 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 thesignerused 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:TransferCartTokenEncoderEncodes a token from theTransferCartTokenand should return the same object with `token` property containing the encoded token string.- Specified by:
encodein 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()
-