public class JWTPreviewTokenDecoder extends Object implements PreviewTokenDecoder
PreviewTokenDecoder
that decoded the PreviewToken
from a JWT token string.Constructor and Description |
---|
JWTPreviewTokenDecoder(JWTPreviewTokenDecoderProperties properties,
com.broadleafcommerce.common.extension.TypeFactory typeFactory,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Primary constructor for initializing the decoder
|
JWTPreviewTokenDecoder(com.broadleafcommerce.common.extension.TypeFactory typeFactory,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Optional constructor if looking to manually configure the decoder using the setters.
|
Modifier and Type | Method and Description |
---|---|
protected PreviewToken |
convertToPreviewToken(com.nimbusds.jwt.JWTClaimsSet claims) |
PreviewToken |
decode(String encodedTokenString)
Decoded an encoded preview token string into a
PreviewToken . |
protected com.fasterxml.jackson.databind.ObjectMapper |
getMapper() |
protected JWTPreviewTokenDecoderProperties |
getProperties() |
protected com.broadleafcommerce.common.extension.TypeFactory |
getTypeFactory() |
protected com.nimbusds.jose.JWSVerifier |
getVerifier() |
void |
setEncodedPublicKey(String encodedPublicKey)
Sets the value of
JWTPreviewTokenDecoderProperties.getEncodedPublicKey() , and
initializes the verifier used to verify JWT tokens. |
void |
setIssuer(String issuer)
Setter for overwriting the current issuer on
JWTPreviewTokenDecoderProperties . |
protected void |
validateJWT(com.nimbusds.jwt.SignedJWT signedJWT) |
public JWTPreviewTokenDecoder(JWTPreviewTokenDecoderProperties properties, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper mapper)
properties
- the property configuration for the decoderpublic JWTPreviewTokenDecoder(com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper mapper)
public void setEncodedPublicKey(String encodedPublicKey)
JWTPreviewTokenDecoderProperties.getEncodedPublicKey()
, and
initializes the verifier
used to verify JWT tokens.encodedPublicKey
- the encoded public keypublic void setIssuer(String issuer)
JWTPreviewTokenDecoderProperties
.issuer
- the issuerpublic PreviewToken decode(String encodedTokenString) throws PreviewTokenParseException
PreviewTokenDecoder
PreviewToken
.decode
in interface PreviewTokenDecoder
encodedTokenString
- the encoded preview token stringPreviewTokenParseException
- when there is an issue with the parsing of the encoded
tokenprotected void validateJWT(com.nimbusds.jwt.SignedJWT signedJWT) throws ParseException, PreviewTokenParseException
protected PreviewToken convertToPreviewToken(com.nimbusds.jwt.JWTClaimsSet claims) throws PreviewTokenParseException
PreviewTokenParseException
protected JWTPreviewTokenDecoderProperties getProperties()
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
protected com.fasterxml.jackson.databind.ObjectMapper getMapper()
protected com.nimbusds.jose.JWSVerifier getVerifier()
Copyright © 2021. All rights reserved.