Class JWTTransferCartTokenDecoder
java.lang.Object
com.broadleafcommerce.cartoperation.service.csr.JWTTransferCartTokenDecoder
- All Implemented Interfaces:
TransferCartTokenDecoder
A default implementation of the
TransferCartTokenDecoder
that decoded the
TransferCartToken
from a JWT token string.-
Constructor Summary
ConstructorDescriptionJWTTransferCartTokenDecoder
(JWTTransferCartTokenDecoderProperties properties, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper mapper) Primary constructor for initializing the decoderJWTTransferCartTokenDecoder
(com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper mapper) Optional constructor if looking to manually configure the decoder using the setters. -
Method Summary
Modifier and TypeMethodDescriptionprotected TransferCartToken
convertToTransferCartToken
(com.nimbusds.jwt.JWTClaimsSet claims) Decoded an encoded transfer cart token string into aTransferCartToken
.protected com.fasterxml.jackson.databind.ObjectMapper
protected JWTTransferCartTokenDecoderProperties
protected com.broadleafcommerce.common.extension.TypeFactory
protected com.nimbusds.jose.JWSVerifier
void
setEncodedPublicKey
(String encodedPublicKey) Sets the value ofJWTTransferCartTokenDecoderProperties.getEncodedPublicKey()
, and initializes theverifier
used to verify JWT tokens.void
Setter for overwriting the current issuer onJWTTransferCartTokenDecoderProperties
.protected void
validateJWT
(com.nimbusds.jwt.SignedJWT signedJWT)
-
Constructor Details
-
JWTTransferCartTokenDecoder
public JWTTransferCartTokenDecoder(JWTTransferCartTokenDecoderProperties properties, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper mapper) Primary constructor for initializing the decoder- Parameters:
properties
- the property configuration for the decoder
-
JWTTransferCartTokenDecoder
public JWTTransferCartTokenDecoder(com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper mapper) Optional constructor if looking to manually configure the decoder using the setters.
-
-
Method Details
-
setEncodedPublicKey
Sets the value ofJWTTransferCartTokenDecoderProperties.getEncodedPublicKey()
, and initializes theverifier
used to verify JWT tokens.- Parameters:
encodedPublicKey
- the encoded public key
-
setIssuer
Setter for overwriting the current issuer onJWTTransferCartTokenDecoderProperties
.- Parameters:
issuer
- the issuer
-
decode
Description copied from interface:TransferCartTokenDecoder
Decoded an encoded transfer cart token string into aTransferCartToken
.- Specified by:
decode
in interfaceTransferCartTokenDecoder
- Parameters:
encodedTokenString
- the encoded transfer cart token string- Returns:
- the decoded transfer cart token
- Throws:
TransferCartTokenParseException
- when there is an issue with the parsing of the encoded token
-
validateJWT
protected void validateJWT(com.nimbusds.jwt.SignedJWT signedJWT) throws ParseException, TransferCartTokenParseException -
convertToTransferCartToken
protected TransferCartToken convertToTransferCartToken(com.nimbusds.jwt.JWTClaimsSet claims) throws TransferCartTokenParseException - Throws:
TransferCartTokenParseException
-
getProperties
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getMapper
protected com.fasterxml.jackson.databind.ObjectMapper getMapper() -
getVerifier
protected com.nimbusds.jose.JWSVerifier getVerifier()
-