Class OAuth2SecurityChecker

java.lang.Object
de.hybris.platform.oauth2.util.OAuth2SecurityChecker

public class OAuth2SecurityChecker extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    clientHasAnyRole(org.springframework.security.core.Authentication authentication, String... roles)
    Check if the OAuth2 client has one of the specified roles.
    boolean
    clientHasRole(org.springframework.security.core.Authentication authentication, String role)
    Check if the OAuth2 client has specified role.
    boolean
    hasAnyScope(org.springframework.security.core.Authentication authentication, String... scopes)
    Check if the OAuth2 authentication has one of the specified scopes.
    boolean
    hasScope(org.springframework.security.core.Authentication authentication, String scope)
    Check if the OAuth2 authentication has one of the specified scopes.
    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.
    boolean
    isUser(org.springframework.security.core.Authentication authentication)
    Check if the current authentication is acting on behalf of an authenticated user.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 object
      role - 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 object
      roles - 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 object
      scope - 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 object
      scopes - 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