Class JWTTransferCartTokenDecoder
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.csr.JWTTransferCartTokenDecoder
-
- All Implemented Interfaces:
TransferCartTokenDecoder
public class JWTTransferCartTokenDecoder extends Object implements TransferCartTokenDecoder
A default implementation of theTransferCartTokenDecoder
that decoded theTransferCartToken
from a JWT token string.
-
-
Constructor Summary
Constructors Constructor Description JWTTransferCartTokenDecoder(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TransferCartToken
convertToTransferCartToken(com.nimbusds.jwt.JWTClaimsSet claims)
TransferCartToken
decode(String encodedTokenString)
Decoded an encoded transfer cart token string into aTransferCartToken
.protected com.fasterxml.jackson.databind.ObjectMapper
getMapper()
protected JWTTransferCartTokenDecoderProperties
getProperties()
protected com.broadleafcommerce.common.extension.TypeFactory
getTypeFactory()
protected com.nimbusds.jose.JWSVerifier
getVerifier()
void
setEncodedPublicKey(String encodedPublicKey)
Sets the value ofJWTTransferCartTokenDecoderProperties.getEncodedPublicKey()
, and initializes theverifier
used to verify JWT tokens.void
setIssuer(String issuer)
Setter for overwriting the current issuer onJWTTransferCartTokenDecoderProperties
.protected void
validateJWT(com.nimbusds.jwt.SignedJWT signedJWT)
-
-
-
Constructor Detail
-
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 Detail
-
setEncodedPublicKey
public void setEncodedPublicKey(String encodedPublicKey)
Sets the value ofJWTTransferCartTokenDecoderProperties.getEncodedPublicKey()
, and initializes theverifier
used to verify JWT tokens.- Parameters:
encodedPublicKey
- the encoded public key
-
setIssuer
public void setIssuer(String issuer)
Setter for overwriting the current issuer onJWTTransferCartTokenDecoderProperties
.- Parameters:
issuer
- the issuer
-
decode
public TransferCartToken decode(String encodedTokenString) throws TransferCartTokenParseException
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
protected JWTTransferCartTokenDecoderProperties getProperties()
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
getMapper
protected com.fasterxml.jackson.databind.ObjectMapper getMapper()
-
getVerifier
protected com.nimbusds.jose.JWSVerifier getVerifier()
-
-