Class TmaUserAccessValidator
- java.lang.Object
-
- de.hybris.platform.b2ctelcooccaddon.validator.TmaUserAccessValidator
-
- All Implemented Interfaces:
org.springframework.validation.Validator
public class TmaUserAccessValidator extends java.lang.Object implements org.springframework.validation.ValidatorValidates if the authenticated user is authorized to access a resource- Since:
- 1907
-
-
Constructor Summary
Constructors Constructor Description TmaUserAccessValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.security.core.AuthenticationgetAuth()protected TmaUserFacadegetUserFacade()protected booleanhasRole(java.lang.String role, org.springframework.security.core.Authentication authentication)Checks if the user has given role.booleanisResourceOwner(org.springframework.security.core.Authentication authentication, java.lang.String userId)Checks if the user isResourceOwner.voidsetUserFacade(TmaUserFacade userFacade)booleansupports(java.lang.Class<?> arg0)voidvalidate(java.lang.Object target, org.springframework.validation.Errors errors)Validates if the given User is valid to see customer details
-
-
-
Method Detail
-
supports
public boolean supports(java.lang.Class<?> arg0)
- Specified by:
supportsin interfaceorg.springframework.validation.Validator
-
validate
public void validate(java.lang.Object target, org.springframework.validation.Errors errors)Validates if the given User is valid to see customer details- Specified by:
validatein interfaceorg.springframework.validation.Validator- Parameters:
target- the User IDerrors- the list of errors
-
getAuth
protected org.springframework.security.core.Authentication getAuth()
-
isResourceOwner
public boolean isResourceOwner(org.springframework.security.core.Authentication authentication, java.lang.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(java.lang.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)
-
-