public class DefaultConsentService extends java.lang.Object implements ConsentService
ConsentService. Service is responsible to generate and provide the consent reference.ANONYMOUS_CONSENTS, CONSENT_GIVEN, CONSENT_WITHDRAWN, PROFILE_CONSENT, PROFILE_CONSENT_GIVEN, USER_CONSENTS| Constructor and Description |
|---|
DefaultConsentService() |
| Modifier and Type | Method and Description |
|---|---|
void |
deleteConsentReferenceInConsentServiceAndInUserModel(UserModel userModel,
java.lang.String baseSiteId)
Deletes the consent reference when the user revokes the consent for profile or user closes the account
|
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 EnhancedCookieGenerator |
getCookieGenerator() |
protected java.util.Optional<BaseSiteModel> |
getCurrentBaseSiteModel() |
protected static java.lang.String |
getDebugFlagValue(UserModel userModel) |
ModelService |
getModelService() |
ProfileConfigurationService |
getProfileConfigurationService() |
RetrieveRestClientStrategy |
getRetrieveRestClientStrategy() |
SessionService |
getSessionService() |
protected java.lang.String |
getSiteId() |
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
|
protected boolean |
isProfileTrackingConsentGivenForAnonymousUser(java.util.Optional<Cookie> anonymousConsentCookie) |
protected boolean |
isProfileTrackingConsentGivenForLoggedInUser() |
protected boolean |
isUserSoftLoggedIn() |
protected static boolean |
isValidConsentReference(java.lang.String consentReferenceId) |
protected static void |
logError(java.lang.Throwable error) |
protected static void |
logSuccess(java.util.Optional<RawResponse> rawResponse,
java.lang.String message) |
protected boolean |
profileTrackingConsentForLoggedInUser(java.lang.String consent) |
void |
removeConsentReferenceCookieAndSession(HttpServletResponse response)
removes the consent reference cookie
|
protected void |
resetConsentReferenceForUser(UserModel user) |
void |
saveConsentReferenceInSessionAndCurrentUserModel(HttpServletRequest request)
It gets the consent reference stored in a cookie (generated by ProfileTag)
and saves it in the session and in the user model (for logged In users) for further events
|
protected void |
setAttributeInSession(java.lang.String key,
java.lang.Object value) |
void |
setBaseSiteService(BaseSiteService baseSiteService) |
protected void |
setConsentReferenceForCurrentUser(java.lang.String consentReferenceId) |
void |
setCookieGenerator(EnhancedCookieGenerator cookieGenerator) |
void |
setModelService(ModelService modelService) |
void |
setProfileConfigurationService(ProfileConfigurationService profileConfigurationService) |
void |
setProfileConsentCookieAndSession(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 boolean |
shouldSendEvent(java.lang.String consentReference,
java.lang.String baseSiteId) |
public boolean isProfileTrackingConsentGiven(HttpServletRequest request)
ConsentServiceisProfileTrackingConsentGiven in interface ConsentServicerequest - the http requestprotected boolean isProfileTrackingConsentGivenForLoggedInUser()
protected boolean profileTrackingConsentForLoggedInUser(java.lang.String consent)
protected boolean isAnonymousUser()
protected boolean isUserSoftLoggedIn()
protected boolean isProfileTrackingConsentGivenForAnonymousUser(java.util.Optional<Cookie> anonymousConsentCookie)
public void saveConsentReferenceInSessionAndCurrentUserModel(HttpServletRequest request)
ConsentServicesaveConsentReferenceInSessionAndCurrentUserModel in interface ConsentServicerequest - Http requestpublic java.lang.String getConsentReferenceFromCookie(java.lang.String siteId,
HttpServletRequest request)
ConsentServicegetConsentReferenceFromCookie in interface ConsentServicesiteId - base site identifierrequest - http requestpublic java.lang.String getConsentReferenceFromSession()
ConsentServicegetConsentReferenceFromSession in interface ConsentServicepublic void setProfileConsentCookieAndSession(HttpServletRequest request,
HttpServletResponse response,
boolean consent)
ConsentServicesetProfileConsentCookieAndSession in interface ConsentServicerequest - http requestresponse - http reponseconsent - true or falsepublic void removeConsentReferenceCookieAndSession(HttpServletResponse response)
ConsentServiceremoveConsentReferenceCookieAndSession in interface ConsentServiceresponse - http responsepublic void deleteConsentReferenceInConsentServiceAndInUserModel(UserModel userModel, java.lang.String baseSiteId)
ConsentServicedeleteConsentReferenceInConsentServiceAndInUserModel in interface ConsentServiceuserModel - the userbaseSiteId - the base site idprotected static java.lang.String getDebugFlagValue(UserModel userModel)
protected boolean shouldSendEvent(java.lang.String consentReference,
java.lang.String baseSiteId)
protected static boolean isValidConsentReference(java.lang.String consentReferenceId)
protected 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(java.util.Optional<RawResponse> rawResponse,
java.lang.String message)
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)
public ModelService getModelService()
public void setModelService(ModelService modelService)
protected void setConsentReferenceForCurrentUser(java.lang.String consentReferenceId)
protected void resetConsentReferenceForUser(UserModel user)
Copyright © 2018 SAP SE. All Rights Reserved.