Class JWTTransferCartTokenEncoder
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.csr.JWTTransferCartTokenEncoder
-
- All Implemented Interfaces:
TransferCartTokenEncoder
public class JWTTransferCartTokenEncoder extends Object implements TransferCartTokenEncoder
A default implementation of theTransferCartTokenEncoderthat encodes theTransferCartTokeninto a JWT token string.
-
-
Constructor Summary
Constructors Constructor Description JWTTransferCartTokenEncoder()Optional constructor if looking to manually configure the encoder using the setters.JWTTransferCartTokenEncoder(JWTTransferCartTokenEncoderProperties properties)Primary constructor for initializing the encoder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TransferCartTokenencode(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 DategetExpirationTime()protected JWTTransferCartTokenEncoderPropertiesgetProperties()protected com.nimbusds.jose.JWSSignergetSigner()voidsetEncodedPrivateKey(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.voidsetIssuer(String issuer)Setter for overwriting the current issuer forJWTTransferCartTokenEncoderProperties.
-
-
-
Constructor Detail
-
JWTTransferCartTokenEncoder
public JWTTransferCartTokenEncoder(@NonNull JWTTransferCartTokenEncoderProperties properties)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 Detail
-
setEncodedPrivateKey
public void setEncodedPrivateKey(String encodedPrivateKey)
Sets the value ofJWTTransferCartTokenEncoderProperties.getEncodedPrivateKey(), and initializes thesignerused to sign JWT tokens.- Parameters:
encodedPrivateKey- the encoded private key
-
setIssuer
public void setIssuer(String issuer)
Setter for overwriting the current issuer forJWTTransferCartTokenEncoderProperties.- Parameters:
issuer- the issuer
-
setExpirationTimeout
public void setExpirationTimeout(Duration expirationTimeout)
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
protected com.nimbusds.jwt.JWTClaimsSet getClaims(TransferCartToken transferCartToken)
-
getExpirationTime
protected Date getExpirationTime()
-
getProperties
protected JWTTransferCartTokenEncoderProperties getProperties()
-
getSigner
protected com.nimbusds.jose.JWSSigner getSigner()
-
-