Package de.hybris.platform.oauth2.util
Class OAuth2SecurityChecker
java.lang.Object
de.hybris.platform.oauth2.util.OAuth2SecurityChecker
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanclientHasAnyRole(org.springframework.security.core.Authentication authentication, String... roles) Check if the OAuth2 client has one of the specified roles.booleanclientHasRole(org.springframework.security.core.Authentication authentication, String role) Check if the OAuth2 client has specified role.booleanhasAnyScope(org.springframework.security.core.Authentication authentication, String... scopes) Check if the OAuth2 authentication has one of the specified scopes.booleanCheck if the OAuth2 authentication has one of the specified scopes.booleanisClient(org.springframework.security.core.Authentication authentication) Check if the current authentication is acting as an authenticated client application not on behalf of a user.booleanisUser(org.springframework.security.core.Authentication authentication) Check if the current authentication is acting on behalf of an authenticated user.
-
Constructor Details
-
OAuth2SecurityChecker
public OAuth2SecurityChecker()
-
-
Method Details
-
clientHasRole
public boolean clientHasRole(org.springframework.security.core.Authentication authentication, String role) Check if the OAuth2 client has specified role.- Parameters:
authentication- The authentication objectrole- The role to check- Returns:
- true if OAuth2 client has this role
-
clientHasAnyRole
public boolean clientHasAnyRole(org.springframework.security.core.Authentication authentication, String... roles) Check if the OAuth2 client has one of the specified roles.- Parameters:
authentication- The authentication objectroles- The roles to check- Returns:
- true if OAuth2 client has one of these roles
-
hasScope
public boolean hasScope(org.springframework.security.core.Authentication authentication, String scope) Check if the OAuth2 authentication has one of the specified scopes.- Parameters:
authentication- The authentication objectscope- The scope to check- Returns:
- true when authentication has required scope
-
hasAnyScope
public boolean hasAnyScope(org.springframework.security.core.Authentication authentication, String... scopes) Check if the OAuth2 authentication has one of the specified scopes.- Parameters:
authentication- The authentication objectscopes- Scopes to check- Returns:
- true if authentication has one of these scopes
-
isUser
public boolean isUser(org.springframework.security.core.Authentication authentication) Check if the current authentication is acting on behalf of an authenticated user.- Parameters:
authentication- The authentication object- Returns:
- true if authentication represents a user
-
isClient
public boolean isClient(org.springframework.security.core.Authentication authentication) Check if the current authentication is acting as an authenticated client application not on behalf of a user.- Parameters:
authentication- The authentication object- Returns:
- true if authentication represents a client application
-