Package com.skava.web
Class UserConsentContoller
java.lang.Object
com.skava.web.UserConsentContoller
This controller class contains service end-points that are used to perform actions to add, remove,
retrieve all opted consents of a user.
- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<UserConsentCreateResponse>
createUserConsent
(long userId, UserConsentList userConsent, String locale, long collectionId, String authToken, String version, long storeId) This service id used to create a new consent action for an user.org.springframework.http.ResponseEntity<Object>
deleteUserConsent
(long userConsentId, long userId, String locale, Long collectionId, String authToken, String version, long storeId) Used to delete the specific user consent.org.springframework.http.ResponseEntity<UserConsentHistoryFindAllResponse>
getAllUserConsentHistory
(int page, int size, long userId, String locale, Long collectionId, String authToken, long storeId) Used to load all the consent for an user.org.springframework.http.ResponseEntity<List<UserConsent>>
getAllUserConsents
(int page, int size, long userId, String locale, Long collectionId, String authToken, long storeId) Used to load all the consent for an user.
-
Constructor Details
-
UserConsentContoller
public UserConsentContoller()Default Constructor.
-
-
Method Details
-
createUserConsent
@PostMapping("/{userId}/consents") @ResponseStatus(CREATED) @Audit(action="createUserConsents") public org.springframework.http.ResponseEntity<UserConsentCreateResponse> createUserConsent(@PathVariable @AuditField(field="USER_ID") long userId, @RequestBody @AuditField(field="USER_CONSENT") UserConsentList userConsent, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTION_ID") long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId) This service id used to create a new consent action for an user.
Consent is similar to user preferences, where user can opt in or opt out of certain things like , Opt in for monthly news letter, News subscription,etc- Parameters:
userId
- Indicates user Id for which user the consent data to be retrieveduserConsent
- HoldsUserConsent
which is used to create a new user consent.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties can be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met:- Token validation against the secret key
- Expiry time should be in the future
- Necessary privileges are available for the user to perform the action on the subjected resource
version
- It hold the value of version number of API. Using this parameter we can access the different version of the API. It is currently unused.storeId
- It Holds a valid unique identifier of the store.- Returns:
- The
ResponseEntity
ofUserConsentResponse
object.
-
getAllUserConsents
@GetMapping("/{userId}/consents") @Audit(action="getUserConsents") public org.springframework.http.ResponseEntity<List<UserConsent>> getAllUserConsents(@RequestParam(value="page",required=false,defaultValue="1") @AuditField(field="PAGE") int page, @RequestParam(value="size",required=false,defaultValue="100") @AuditField(field="SIZE") int size, @PathVariable @AuditField(field="USER_ID") long userId, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTION_ID") Long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId) Used to load all the consent for an user.- Parameters:
page
- Indicates the page of loaded user consents for the particular notes.size
- Indicates the individual page size of the loaded user consents for the particular user.userId
- Indicates user Id for which user the consent data to be retrievedlocale
- API Response and error messages will be responded in the locale mentioned in this parameter.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties can be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met:- Token validation against the secret key
- Expiry time should be in the future
- Necessary privileges are available for the user to perform the action on the subjected resource
storeId
- It Holds a valid unique identifier of the store.- Returns:
- The
ResponseEntity
ofUserConsentFindAllResponse
object.
-
deleteUserConsent
@DeleteMapping("/{userId}/consents/{userConsentId}") @Audit(action="deleteUserConsent") public org.springframework.http.ResponseEntity<Object> deleteUserConsent(@PathVariable @AuditField(field="USER_CONSENT_ID") long userConsentId, @PathVariable @AuditField(field="USER_ID") long userId, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTION_ID") Long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId) Used to delete the specific user consent.- Parameters:
userConsentId
- Indicates user consent Id for which user consent data to be deleteduserId
- Indicates user Id for which user the consent data to be deletedlocale
- API Response and error messages will be responded in the locale mentioned in this parameter.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties can be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met:- Token validation against the secret key
- Expiry time should be in the future
- Necessary privileges are available for the user to perform the action on the subjected resource
version
- It hold the value of version number of API. Using this parameter we can access the different version of the API. It is currently unused.storeId
- It Holds a valid unique identifier of the store.- Returns:
- The
ResponseEntity
ofObject
.
-
getAllUserConsentHistory
@GetMapping("/{userId}/consenthistory") @Audit(action="getUserConsentHistories") public org.springframework.http.ResponseEntity<UserConsentHistoryFindAllResponse> getAllUserConsentHistory(@RequestParam(value="page",required=false,defaultValue="1") @AuditField(field="PAGE") int page, @RequestParam(value="size",required=false,defaultValue="100") @AuditField(field="SIZE") int size, @PathVariable @AuditField(field="USER_ID") long userId, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTION_ID") Long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId) Used to load all the consent for an user.- Parameters:
page
- Indicates the page of loaded user consents for the particular notes.size
- Indicates the individual page size of the loaded user consents for the particular user.userId
- Indicates user Id for which user the consent data to be retrievedlocale
- API Response and error messages will be responded in the locale mentioned in this parameter.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties can be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met:- Token validation against the secret key
- Expiry time should be in the future
- Necessary privileges are available for the user to perform the action on the subjected resource
storeId
- It Holds a valid unique identifier of the store.- Returns:
- The
ResponseEntity
ofUserConsentFindAllResponse
object.
-