Package de.hybris.platform.oauth2.util
Class OAuth2SecurityChecker
- java.lang.Object
-
- de.hybris.platform.oauth2.util.OAuth2SecurityChecker
-
public class OAuth2SecurityChecker extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description OAuth2SecurityChecker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanclientHasAnyRole(org.springframework.security.core.Authentication authentication, java.lang.String... roles)Check if the OAuth2 client has one of the specified roles.booleanclientHasRole(org.springframework.security.core.Authentication authentication, java.lang.String role)Check if the OAuth2 client has specified role.booleanhasAnyScope(org.springframework.security.core.Authentication authentication, java.lang.String... scopes)Check if the OAuth2 authentication has one of the specified scopes.booleanhasScope(org.springframework.security.core.Authentication authentication, java.lang.String scope)Check 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.
-
-
-
Method Detail
-
clientHasRole
public boolean clientHasRole(org.springframework.security.core.Authentication authentication, java.lang.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, java.lang.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, java.lang.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, java.lang.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
-
-