Interface ConsentService
- All Known Implementing Classes:
DefaultConsentService
public interface ConsentService
ConsentService interface. Service is responsible to generate and provide the consent reference.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteConsentReferenceInConsentServiceAndInConsentModel(ConsentModel consentModel, String baseSiteId) Deletes the consent reference when the user revokes the consent for profile or user closes the accountFetches the consent reference from the active consent model.getConsentReferenceFromCookie(String siteId, javax.servlet.http.HttpServletRequest request) Fetches the consent reference from cookiegetConsentReferenceFromHeader(javax.servlet.http.HttpServletRequest request) Fetches the consent reference from header name specified in the property profileservices.occ.consent.header.nameFetches the consent reference from sessionbooleanChecks if the user (logged in or anonymous) has granted the consent to allow profile trackingbooleanisProfileTrackingConsentGiven(javax.servlet.http.HttpServletRequest request) Checks if the user (logged In or Anonymous) has granted the consent to allow profile trackingvoidremoves the consent reference in sessionvoidsaveConsentReferenceInSession(String consentId) It gets the consent reference stored in a cookie and saves it in the session for further eventsvoidsaveConsentReferenceInSessionAndConsentModel(javax.servlet.http.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 eventsvoidsetProfileConsent(boolean consent) voidsetProfileConsentCookieAndSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean consent) Saves the profile consent separately in a cookie and session attributevoidsetProfileIdCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String consentReferenceId) Saves the profile id i.e old consent reference separately as a session cookie so that profile tag can skip getting a new consent reference.
-
Method Details
-
isProfileTrackingConsentGiven
boolean isProfileTrackingConsentGiven(javax.servlet.http.HttpServletRequest request) Checks if the user (logged In or Anonymous) has granted the consent to allow profile tracking- Parameters:
request- the http request- Returns:
- true or false
-
setProfileConsentCookieAndSession
void setProfileConsentCookieAndSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean consent) Saves the profile consent separately in a cookie and session attribute- Parameters:
request- http requestresponse- http reponseconsent- true or false
-
setProfileConsent
void setProfileConsent(boolean consent) -
saveConsentReferenceInSessionAndConsentModel
void saveConsentReferenceInSessionAndConsentModel(javax.servlet.http.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- Parameters:
request- Http request
-
getConsentReferenceFromCookie
Fetches the consent reference from cookie- Parameters:
siteId- base site identifierrequest- http request- Returns:
- consent reference
-
getConsentReferenceFromHeader
Fetches the consent reference from header name specified in the property profileservices.occ.consent.header.name- Parameters:
request- http request- Returns:
- consent reference
-
getConsentReferenceFromSession
String getConsentReferenceFromSession()Fetches the consent reference from session- Returns:
- consent reference
-
getConsentReferenceFromConsentModel
String getConsentReferenceFromConsentModel()Fetches the consent reference from the active consent model.- Returns:
- consent reference
-
deleteConsentReferenceInConsentServiceAndInConsentModel
void deleteConsentReferenceInConsentServiceAndInConsentModel(ConsentModel consentModel, String baseSiteId) Deletes the consent reference when the user revokes the consent for profile or user closes the account- Parameters:
consentModel- the userbaseSiteId- the base site id
-
removeConsentReferenceInSession
void removeConsentReferenceInSession()removes the consent reference in session- Parameters:
response- http response
-
saveConsentReferenceInSession
It gets the consent reference stored in a cookie and saves it in the session for further events- Parameters:
consentId- the consent reference
-
isProfileTrackingConsentGiven
boolean isProfileTrackingConsentGiven()Checks if the user (logged in or anonymous) has granted the consent to allow profile tracking- Returns:
- true if consent is given
-
setProfileIdCookie
void setProfileIdCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String consentReferenceId) Saves the profile id i.e old consent reference separately as a session cookie so that profile tag can skip getting a new consent reference.- Parameters:
request- http requestresponse- http response to which the cookie is added if the request doesnt have CR cookieconsentReferenceId- the profile id or consent reference id of the user
-