public class DefaultCartCookieIssuer extends Object implements CartCookieIssuer
CartCookieIssuer
Constructor and Description |
---|
DefaultCartCookieIssuer(CartCookieProperties cookieProps) |
Modifier and Type | Method and Description |
---|---|
protected void |
addCartCookieClaims(com.nimbusds.jwt.JWTClaimsSet.Builder jwtBuilder,
com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
javax.servlet.http.Cookie |
buildCartCookie(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Build a cookie to hold a reference to a cart.
|
javax.servlet.http.Cookie |
buildCartExpirationCookie(String applicationId)
Build a cookie meant to remove the cart cookie for the provided application.
|
org.springframework.http.ResponseCookie |
buildCartResponseCookie(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Build a cookie to hold a reference to a cart.
|
boolean |
checkContextMatches(Map<String,Object> cartCookieClaims,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Check if the provided cookie claims match the context.
|
protected String |
getApplicationId(com.broadleafcommerce.cart.client.domain.Cart cart) |
String |
getCartCookieName(String applicationId)
Name of the cart cookie.
|
protected Duration |
getCartTtl() |
protected boolean |
isApplicationIdIncludedInCookieName() |
Optional<String> |
resolveCartId(Map<String,Object> cartCookieClaims)
Resolve the cart id from the provided cookie claims.
|
protected <T> Optional<T> |
resolveClaim(Map<String,Object> cartCookieClaims,
String name,
Class<T> clazz) |
protected Optional<com.nimbusds.jwt.SignedJWT> |
verify(javax.servlet.http.Cookie cartCookie) |
Map<String,Object> |
verifyAndGetClaims(@NonNull javax.servlet.http.Cookie cartCookie)
Verify the provided cart cookie and get its claims.
|
public DefaultCartCookieIssuer(CartCookieProperties cookieProps)
public javax.servlet.http.Cookie buildCartCookie(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CartCookieIssuer
buildCartCookie
in interface CartCookieIssuer
cart
- The cart for which to build a cookie.contextInfo
- Context information around sandbox and multitenant state.public org.springframework.http.ResponseCookie buildCartResponseCookie(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CartCookieIssuer
buildCartResponseCookie
in interface CartCookieIssuer
cart
- The cart for which to build a cookie.contextInfo
- Context information around sandbox and multitenant state.protected void addCartCookieClaims(com.nimbusds.jwt.JWTClaimsSet.Builder jwtBuilder, com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected String getApplicationId(com.broadleafcommerce.cart.client.domain.Cart cart)
public javax.servlet.http.Cookie buildCartExpirationCookie(String applicationId)
CartCookieIssuer
buildCartExpirationCookie
in interface CartCookieIssuer
applicationId
- Application id used to identify which cart cookie to remove.public Map<String,Object> verifyAndGetClaims(@NonNull @NonNull javax.servlet.http.Cookie cartCookie)
CartCookieIssuer
verifyAndGetClaims
in interface CartCookieIssuer
cartCookie
- The cookie to use for retrieving the claimspublic Optional<String> resolveCartId(Map<String,Object> cartCookieClaims)
CartCookieIssuer
resolveCartId
in interface CartCookieIssuer
cartCookieClaims
- The cookie claims to use for retrieving the cart id.protected <T> Optional<T> resolveClaim(Map<String,Object> cartCookieClaims, String name, Class<T> clazz)
protected Optional<com.nimbusds.jwt.SignedJWT> verify(javax.servlet.http.Cookie cartCookie) throws ParseException, com.nimbusds.jose.JOSEException
ParseException
com.nimbusds.jose.JOSEException
public String getCartCookieName(@Nullable String applicationId)
CartCookieIssuer
getCartCookieName
in interface CartCookieIssuer
applicationId
- Application id that may be appended to the cookie name.public boolean checkContextMatches(Map<String,Object> cartCookieClaims, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CartCookieIssuer
checkContextMatches
in interface CartCookieIssuer
cartCookieClaims
- The cookie claims to use for retrieving the cart id.contextInfo
- Context information around sandbox and multitenant state.protected boolean isApplicationIdIncludedInCookieName()
protected Duration getCartTtl()
Copyright © 2021. All rights reserved.