Class UserValidator
java.lang.Object
de.hybris.platform.b2ctelcotmfwebservices.security.UserValidator
Validates if the authenticated user is authorized to access a resource
- Since:
- 1907
-
Constructor Summary
ConstructorsConstructorDescriptionUserValidator(TmaSubscribedProductFacade tmaSubscribedProductFacade, TmaSubscriptionBaseFacade tmaSubscriptionBaseFacade) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanUserListOrders(org.springframework.security.core.Authentication authentication, String relatedPartyId) Checks if the user is able to access orders.protected TmaOrderFacadeprotected TmaSubscribedProductFacadeprotected TmaSubscriptionBaseFacadeprotected booleanChecks if the user has given role.booleanisAnonymous(org.springframework.security.core.Authentication authentication, ShoppingCart shoppingCart) Checks if the first user provided in the list of related parties of the shopping cart is Anonymous and the client is authenticated.booleanisAnonymous(org.springframework.security.core.Authentication authentication, ShoppingCartUnderscoreCreate shoppingCart) Deprecated, for removal: This API element is subject to removal in a future version.since 1911.booleanisAnonymous(org.springframework.security.core.Authentication authentication, ShoppingCartUnderscoreUpdate shoppingCart) Deprecated, for removal: This API element is subject to removal in a future version.since 1911.booleanisAnonymous(org.springframework.security.core.Authentication authentication, String userId) Checks if the user provided is Anonymous and the client is authenticated.booleanisAnonymous(org.springframework.security.core.Authentication authentication, List<RelatedPartyRef> relatedParties) Checks if the first user provided in the list of related parties is Anonymous and the client is authenticated.booleanisAuthorizedForProductOrderUpdate(org.springframework.security.core.Authentication authentication, ProductOrder productOrder, String orderId) Checks if the authenticated party has required permissions to access the requested product order.booleanisAuthorizedForProductOrderUpdate(org.springframework.security.core.Authentication authentication, List<RelatedPartyRef> relatedParties, String orderId) Checks if the authenticated party has required permissions to access the requested product order.booleanisAuthorizedSubscriptionUser(org.springframework.security.core.Authentication authentication, String identifier) Checks if the user has access to the subscribed product or subscription base of given id and the client is authenticated.booleanisNotAnonymous(ProductOrder productOrder) Checks if the user provided is not Anonymous.booleanisNotAnonymous(String userId) Checks if the user provided is not Anonymous.booleanisNotAnonymous(List<RelatedPartyRef> relatedParties) Checks if user provided in theRelatedPartyReflist is anonymous.booleanisRelatedPartyAuthorizedShoppingCartUser(org.springframework.security.core.Authentication authentication, ShoppingCart shoppingCart) From the list of related parties provided in theShoppingCartobject the first item is used for checking if it matches with the principal for which authorization has been obtained.booleanisRelatedPartyAuthorizedToCreateShoppingCart(org.springframework.security.core.Authentication authentication, ShoppingCartUnderscoreCreate shoppingCart) Deprecated, for removal: This API element is subject to removal in a future version.since 1911.booleanisRelatedPartyAuthorizedToPlaceOrder(org.springframework.security.core.Authentication authentication, ProductOrder productOrder) From the list of related parties provided in the productOrder object the first item is used for checking if it matches with the principal for which authorization has been obtained.booleanisRelatedPartyAuthorizedToPlaceOrder(org.springframework.security.core.Authentication authentication, List<RelatedPartyRef> relatedParties) From the list of related parties provided the first item is used for checking if it matches with the principal for which authorization has been obtained.booleanisRelatedPartyAuthorizedToUpdateShoppingCart(org.springframework.security.core.Authentication authentication, ShoppingCartUnderscoreUpdate shoppingCart) Deprecated, for removal: This API element is subject to removal in a future version.since 1911.booleanisRelatedPartyAuthorizedUserOrAdmin(org.springframework.security.core.Authentication authentication, List<RelatedPartyRef> relatedParties) From the list of related parties provided the first item is used for checking if it matches with the principal for which authorization has been obtained.booleanisRelatedPartyTrustedClientAndUpdateStatus(org.springframework.security.core.Authentication authentication, ShoppingCart shoppingCart) Checks if the request is for updating cart status, related party id matches with principal for which authorization has been obtained and if the client id is trusted or not.booleanisResourceOwner(org.springframework.security.core.Authentication authentication, String userId) booleanisSubscriptionBaseOwner(org.springframework.security.core.Authentication authentication, String subscriptionBaseId) booleanvalidateUser(org.springframework.security.core.Authentication authentication, String userId)
-
Constructor Details
-
UserValidator
public UserValidator(TmaSubscribedProductFacade tmaSubscribedProductFacade, TmaSubscriptionBaseFacade tmaSubscriptionBaseFacade)
-
-
Method Details
-
validateUser
public boolean validateUser(org.springframework.security.core.Authentication authentication, String userId) -
isResourceOwner
public boolean isResourceOwner(org.springframework.security.core.Authentication authentication, String userId) -
isSubscriptionBaseOwner
public boolean isSubscriptionBaseOwner(org.springframework.security.core.Authentication authentication, String subscriptionBaseId) -
isRelatedPartyAuthorizedToPlaceOrder
public boolean isRelatedPartyAuthorizedToPlaceOrder(org.springframework.security.core.Authentication authentication, ProductOrder productOrder) From the list of related parties provided in the productOrder object the first item is used for checking if it matches with the principal for which authorization has been obtained.- Parameters:
authentication- authentication objectproductOrder- the product order from where the related party being checked is obtained- Returns:
- true in case the authentication is not client only and if the principal matches with the id of thew first related party provided
-
isRelatedPartyAuthorizedToPlaceOrder
public boolean isRelatedPartyAuthorizedToPlaceOrder(org.springframework.security.core.Authentication authentication, List<RelatedPartyRef> relatedParties) From the list of related parties provided the first item is used for checking if it matches with the principal for which authorization has been obtained.- Parameters:
authentication- authentication objectrelatedParties- related parties being checked- Returns:
- true in case the authentication is not client only and if the principal matches with the id of thew first related party provided
-
isNotAnonymous
Checks if the user provided is not Anonymous.- Parameters:
userId- The userId provided.- Returns:
- False if user is anonymous, otherwise true.
-
isNotAnonymous
Checks if the user provided is not Anonymous.- Parameters:
productOrder- the product order from where the related party being checked is obtained.- Returns:
- False if user is anonymous, otherwise true.
-
isNotAnonymous
Checks if user provided in theRelatedPartyReflist is anonymous. .- Parameters:
relatedParties- the product order from where the related party being checked is obtained.- Returns:
- False if user is anonymous, otherwise true.
-
isAnonymous
public boolean isAnonymous(org.springframework.security.core.Authentication authentication, String userId) Checks if the user provided is Anonymous and the client is authenticated.- Parameters:
authentication- - the authenticated clientuserId- The userId provided.- Returns:
- true if user is anonymous, otherwise false.
-
isRelatedPartyAuthorizedToUpdateShoppingCart
@Deprecated(since="1911", forRemoval=true) public boolean isRelatedPartyAuthorizedToUpdateShoppingCart(org.springframework.security.core.Authentication authentication, ShoppingCartUnderscoreUpdate shoppingCart) Deprecated, for removal: This API element is subject to removal in a future version.From the list of related parties provided in theShoppingCartUnderscoreUpdateobject the first item is used for checking if it matches with the principal for which authorization has been obtained.- Parameters:
authentication- authentication objectshoppingCart- the shopping cart from where the list of related parties being checked is obtained- Returns:
- true in case the authentication is not client only and if the principal matches with the id of the first related party provided
-
isRelatedPartyAuthorizedShoppingCartUser
public boolean isRelatedPartyAuthorizedShoppingCartUser(org.springframework.security.core.Authentication authentication, ShoppingCart shoppingCart) From the list of related parties provided in theShoppingCartobject the first item is used for checking if it matches with the principal for which authorization has been obtained.- Parameters:
authentication- authentication objectshoppingCart- the shopping cart from where the list of related parties being checked is obtained- Returns:
- true in case the authentication is not client only and if the principal matches with the id of the first related party provided
-
isRelatedPartyAuthorizedToCreateShoppingCart
@Deprecated(since="1911", forRemoval=true) public boolean isRelatedPartyAuthorizedToCreateShoppingCart(org.springframework.security.core.Authentication authentication, ShoppingCartUnderscoreCreate shoppingCart) Deprecated, for removal: This API element is subject to removal in a future version.From the list of related parties provided in theShoppingCartUnderscoreCreateobject the first item is used for checking if it matches with the principal for which authorization has been obtained.- Parameters:
authentication- authentication objectshoppingCart- the shopping cart from where the list of related parties being checked is obtained- Returns:
- true in case the authentication is not client only and if the principal matches with the id of the first related party provided
-
isAnonymous
public boolean isAnonymous(org.springframework.security.core.Authentication authentication, ShoppingCart shoppingCart) Checks if the first user provided in the list of related parties of the shopping cart is Anonymous and the client is authenticated.- Parameters:
authentication- the authenticated clientshoppingCart- the shopping cart from where the list of related parties being checked is obtained- Returns:
- true if user is anonymous, otherwise false.
-
isAnonymous
@Deprecated(since="1911", forRemoval=true) public boolean isAnonymous(org.springframework.security.core.Authentication authentication, ShoppingCartUnderscoreUpdate shoppingCart) Deprecated, for removal: This API element is subject to removal in a future version.since 1911. UseisAnonymous(Authentication, ShoppingCart)Checks if the first user provided in the list of related parties of the shopping cart is Anonymous and the client is authenticated.- Parameters:
authentication- the authenticated clientshoppingCart- the shopping cart from where the list of related parties being checked is obtained- Returns:
- true if user is anonymous, otherwise false.
-
isAnonymous
@Deprecated(since="1911", forRemoval=true) public boolean isAnonymous(org.springframework.security.core.Authentication authentication, ShoppingCartUnderscoreCreate shoppingCart) Deprecated, for removal: This API element is subject to removal in a future version.since 1911. UseisAnonymous(Authentication, ShoppingCart)Checks if the first user provided in the list of related parties of the shopping cart is Anonymous and the client is authenticated.- Parameters:
authentication- the authenticated clientshoppingCart- the shopping cart from where the list of related parties being checked is obtained- Returns:
- true if user is anonymous, otherwise false.
-
isAnonymous
public boolean isAnonymous(org.springframework.security.core.Authentication authentication, List<RelatedPartyRef> relatedParties) Checks if the first user provided in the list of related parties is Anonymous and the client is authenticated.- Parameters:
authentication- the authenticated clientrelatedParties- the list of related parties- Returns:
- true if user is anonymous, otherwise false.
-
isRelatedPartyAuthorizedUserOrAdmin
public boolean isRelatedPartyAuthorizedUserOrAdmin(org.springframework.security.core.Authentication authentication, List<RelatedPartyRef> relatedParties) From the list of related parties provided the first item is used for checking if it matches with the principal for which authorization has been obtained.- Parameters:
authentication- authentication objectrelatedParties- the list of related parties- Returns:
- true in case the authentication is not client only and if the principal matches with the id of the first related party provided
-
isRelatedPartyTrustedClientAndUpdateStatus
public boolean isRelatedPartyTrustedClientAndUpdateStatus(org.springframework.security.core.Authentication authentication, ShoppingCart shoppingCart) Checks if the request is for updating cart status, related party id matches with principal for which authorization has been obtained and if the client id is trusted or not.- Parameters:
authentication- authentication objectshoppingCart- The shopping cart- Returns:
- true if request is to update cart status and if the principal matches with the id of the first related party provided and client is trusted, otherwise false
-
isAuthorizedSubscriptionUser
public boolean isAuthorizedSubscriptionUser(org.springframework.security.core.Authentication authentication, String identifier) Checks if the user has access to the subscribed product or subscription base of given id and the client is authenticated.- Parameters:
authentication- the authenticated clientidentifier- identifier of subscribed product or subscription base- Returns:
- true if user has Owner or Beneficiary access to subscribed product or subscription base, otherwise false.
-
canUserListOrders
public boolean canUserListOrders(org.springframework.security.core.Authentication authentication, String relatedPartyId) Checks if the user is able to access orders. The business logic of the access to orders is defined in the corresponding order service.- Parameters:
authentication- the authenticated clientrelatedPartyId- identifier of the related party- Returns:
- true if related party provided is able to access orders, otherwise false.
-
isAuthorizedForProductOrderUpdate
public boolean isAuthorizedForProductOrderUpdate(org.springframework.security.core.Authentication authentication, ProductOrder productOrder, String orderId) Checks if the authenticated party has required permissions to access the requested product order.- Parameters:
authentication- The authentication objectproductOrder- The product order- Returns:
- True if the authenticated object has the required permissions to access the requested product order, otherwise false
-
isAuthorizedForProductOrderUpdate
public boolean isAuthorizedForProductOrderUpdate(org.springframework.security.core.Authentication authentication, List<RelatedPartyRef> relatedParties, String orderId) Checks if the authenticated party has required permissions to access the requested product order.- Parameters:
authentication- The authentication objectrelatedParties- The related party list of the product order- Returns:
- True if the authenticated object has the required permissions to access the requested product order, otherwise false
-
hasRole
protected boolean hasRole(String role, org.springframework.security.core.Authentication authentication) Checks if the user has given role.- Parameters:
role- The role is provided as stringauthentication- The authentication object- Returns:
- False if logged in user doesn't have given role, otherwise true.
-
getTmaSubscribedProductFacade
-
getTmaSubscriptionBaseFacade
-
getOrderFacade
-