java.lang.Object
de.hybris.platform.b2ctelcocommercewebservicescommons.validator.TmaUserAccessValidator
All Implemented Interfaces:
org.springframework.validation.Validator

public class TmaUserAccessValidator extends Object implements org.springframework.validation.Validator
Validates if the authenticated user is authorized to access a resource
Since:
1907
  • Constructor Details

    • TmaUserAccessValidator

      public TmaUserAccessValidator(TmaUserFacade userFacade)
  • Method Details

    • supports

      public boolean supports(Class<?> arg0)
      Specified by:
      supports in interface org.springframework.validation.Validator
    • validate

      public void validate(Object target, org.springframework.validation.Errors errors)
      Validates if the given User is valid to see customer details
      Specified by:
      validate in interface org.springframework.validation.Validator
      Parameters:
      target - the User ID
      errors - the list of errors
    • getAuth

      protected org.springframework.security.core.Authentication getAuth()
    • isResourceOwner

      public boolean isResourceOwner(org.springframework.security.core.Authentication authentication, String userId)
      Checks if the user isResourceOwner.
      Parameters:
      userId - The userId provided.
      Returns:
      False if user is not logged in user, otherwise true.
    • 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 string
      Returns:
      False if logged in user doesn't have given role, otherwise true.
    • getUserFacade

      protected TmaUserFacade getUserFacade()
    • setUserFacade

      public void setUserFacade(TmaUserFacade userFacade)