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 theTransferCartTokenEncoder
that encodes theTransferCartToken
into 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 TransferCartToken
encode(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
getExpirationTime()
protected JWTTransferCartTokenEncoderProperties
getProperties()
protected com.nimbusds.jose.JWSSigner
getSigner()
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
setIssuer(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 thesigner
used 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: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
protected com.nimbusds.jwt.JWTClaimsSet getClaims(TransferCartToken transferCartToken)
-
getExpirationTime
protected Date getExpirationTime()
-
getProperties
protected JWTTransferCartTokenEncoderProperties getProperties()
-
getSigner
protected com.nimbusds.jose.JWSSigner getSigner()
-
-