Class TmaUserAccessValidator
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.security.core.AuthenticationgetAuth()protected TmaUserFacadeprotected booleanChecks if the user has given role.booleanisResourceOwner(org.springframework.security.core.Authentication authentication, String userId) Checks if the user isResourceOwner.voidsetUserFacade(TmaUserFacade userFacade) booleanvoidValidates if the given User is valid to see customer details
-
Constructor Details
-
TmaUserAccessValidator
-
-
Method Details
-
supports
- Specified by:
supportsin interfaceorg.springframework.validation.Validator
-
validate
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, 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
-
setUserFacade
-