public class DefaultConsentService extends java.lang.Object implements ConsentService
ConsentService. Service is responsible to generate and provide the consent reference.ANONYMOUS_CONSENTS, CONSENT_GIVEN, PROFILE_CONSENT, PROFILE_CONSENT_GIVEN, USER_CONSENTS| Constructor and Description |
|---|
DefaultConsentService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addConsentReferenceCookie(HttpServletResponse response,
java.lang.String consentReferenceId,
java.lang.String token) |
void |
generateConsentReference(HttpServletRequest request,
HttpServletResponse response)
Generates the consent reference for the user and stores it both in a cookie
and in the session
|
void |
generateConsentReference(HttpServletRequest request,
HttpServletResponse response,
boolean shouldGenerateConsentReference)
Generates the consent reference for the user and stores it both in a cookie
and in the session
|
<any> |
generateConsentReferenceForUser(java.lang.String userId)
Executes the rest call to the consent service to get the consent reference for a given user
|
BaseSiteService |
getBaseSiteService() |
protected ConsentServiceClient |
getClient() |
java.lang.String |
getConsentReferenceFromCookie(java.lang.String siteId,
HttpServletRequest request)
Fetches the consent reference from cookie
|
java.lang.String |
getConsentReferenceFromSession()
Fetches the consent reference from session
|
protected java.lang.String |
getConsentReferenceTokenFromCookie(HttpServletRequest request) |
protected EnhancedCookieGenerator |
getCookieGenerator() |
protected java.util.Optional<BaseSiteModel> |
getCurrentBaseSiteModel() |
ProfileConfigurationService |
getProfileConfigurationService() |
RetrieveRestClientStrategy |
getRetrieveRestClientStrategy() |
SessionService |
getSessionService() |
protected java.lang.String |
getSiteId() |
protected java.lang.String |
getUserId() |
UserService |
getUserService() |
protected boolean |
isAnonymousUser() |
boolean |
isProfileTrackingConsentGiven(HttpServletRequest request)
Checks if the user (logged In or Anonymous) has granted the consent to allow profile tracking
|
boolean |
isProfileTrackingConsentGivenForAnonymousUser(java.util.Optional<Cookie> anonymousConsentCookie)
Checks if the Anonymous User has granted the consent to allow profile tracking
The consents for Anonymous Users are stored in a Cookie
|
boolean |
isProfileTrackingConsentGivenForLoggedInUser()
Checks if the Log In User has granted the consent to allow profile tracking
The consents for Log In Users are stored in Session
|
protected boolean |
isUserSoftLoggedIn() |
protected static void |
logError(java.lang.Throwable error) |
protected static void |
logSuccess(ConsentResponse consentResponse) |
protected void |
setAttributeInSession(java.lang.String key,
java.lang.Object value) |
void |
setBaseSiteService(BaseSiteService baseSiteService) |
void |
setCookieGenerator(EnhancedCookieGenerator cookieGenerator) |
void |
setProfileConfigurationService(ProfileConfigurationService profileConfigurationService) |
void |
setProfileConsentCookie(HttpServletRequest request,
HttpServletResponse response,
boolean consent)
Saves the profile consent separately in a cookie and session attribute
|
void |
setRetrieveRestClientStrategy(RetrieveRestClientStrategy retrieveRestClientStrategy) |
void |
setSessionService(SessionService sessionService) |
void |
setUserService(UserService userService) |
protected void |
storeConsentReferenceInSession(java.lang.String consentReferenceId,
java.lang.String token) |
public boolean isProfileTrackingConsentGiven(HttpServletRequest request)
ConsentServiceisProfileTrackingConsentGiven in interface ConsentServicerequest - the http requestpublic boolean isProfileTrackingConsentGivenForLoggedInUser()
ConsentServiceisProfileTrackingConsentGivenForLoggedInUser in interface ConsentServiceprotected boolean isAnonymousUser()
protected boolean isUserSoftLoggedIn()
public boolean isProfileTrackingConsentGivenForAnonymousUser(java.util.Optional<Cookie> anonymousConsentCookie)
ConsentServiceisProfileTrackingConsentGivenForAnonymousUser in interface ConsentServicepublic void generateConsentReference(HttpServletRequest request,
HttpServletResponse response)
ConsentServicegenerateConsentReference in interface ConsentServicerequest - Http requestresponse - Http response with the consent reference cookiepublic void generateConsentReference(HttpServletRequest request,
HttpServletResponse response,
boolean shouldGenerateConsentReference)
ConsentServicegenerateConsentReference in interface ConsentServicerequest - Http requestresponse - Http response with the consent reference cookieshouldGenerateConsentReference - should generate consent referenceprotected java.lang.String getUserId()
public java.lang.String getConsentReferenceFromCookie(java.lang.String siteId,
HttpServletRequest request)
ConsentServicegetConsentReferenceFromCookie in interface ConsentServicesiteId - base site identifierrequest - http requestprotected java.lang.String getConsentReferenceTokenFromCookie(HttpServletRequest request)
protected void addConsentReferenceCookie(HttpServletResponse response,
java.lang.String consentReferenceId,
java.lang.String token)
protected void storeConsentReferenceInSession(java.lang.String consentReferenceId,
java.lang.String token)
public void setProfileConsentCookie(HttpServletRequest request,
HttpServletResponse response,
boolean consent)
ConsentServicesetProfileConsentCookie in interface ConsentServicerequest - http requestresponse - http reponseconsent - true or falsepublic java.lang.String getConsentReferenceFromSession()
ConsentServicegetConsentReferenceFromSession in interface ConsentServicepublic <any> generateConsentReferenceForUser(java.lang.String userId)
ConsentServicegenerateConsentReferenceForUser in interface ConsentServiceuserId - the user idprotected void setAttributeInSession(java.lang.String key,
java.lang.Object value)
protected java.lang.String getSiteId()
protected java.util.Optional<BaseSiteModel> getCurrentBaseSiteModel()
protected static void logSuccess(ConsentResponse consentResponse)
protected static void logError(java.lang.Throwable error)
protected ConsentServiceClient getClient()
protected EnhancedCookieGenerator getCookieGenerator()
public void setCookieGenerator(EnhancedCookieGenerator cookieGenerator)
public SessionService getSessionService()
public void setSessionService(SessionService sessionService)
public UserService getUserService()
public void setUserService(UserService userService)
public ProfileConfigurationService getProfileConfigurationService()
public void setProfileConfigurationService(ProfileConfigurationService profileConfigurationService)
public RetrieveRestClientStrategy getRetrieveRestClientStrategy()
public void setRetrieveRestClientStrategy(RetrieveRestClientStrategy retrieveRestClientStrategy)
public BaseSiteService getBaseSiteService()
public void setBaseSiteService(BaseSiteService baseSiteService)
Copyright © 2018 SAP SE. All Rights Reserved.