Class OAuthClientVoter

java.lang.Object
de.hybris.platform.ycommercewebservices.oauth2.OAuthClientVoter
All Implemented Interfaces:
org.springframework.security.access.AccessDecisionVoter<Object>

public class OAuthClientVoter extends Object implements org.springframework.security.access.AccessDecisionVoter<Object>
Votes to grant access if current OAuth Client ID matches with any config attribute

Only config attributes starting with 'prefix' will be took into consideration. Default prefix is 'CLIENT_'. Prefix can be customized, in particular when null all config attributes will be analyzed.

If none of the configuration attributes starts with 'prefix', the voter abstains from voting.

If there are some configuration attributes starting with prefix but none matches, the voter denies access.

Comparisions are case insensitive.

Example: if config attribute = 'CLIENT_MOBILE_ANDROID' and client id is 'mobile_android' access by this voter is granted

  • Field Summary

    Fields inherited from interface org.springframework.security.access.AccessDecisionVoter

    ACCESS_ABSTAIN, ACCESS_DENIED, ACCESS_GRANTED
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    void
    setClientPrefix(String clientPrefix)
     
    boolean
    supports(Class<?> clazz)
    This implementation supports any type of class, because it does not query the presented secure object.
    boolean
    supports(org.springframework.security.access.ConfigAttribute attribute)
     
    int
    vote(org.springframework.security.core.Authentication authentication, Object object, Collection<org.springframework.security.access.ConfigAttribute> attributes)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OAuthClientVoter

      public OAuthClientVoter()
  • Method Details

    • getClientPrefix

      public String getClientPrefix()
    • setClientPrefix

      public void setClientPrefix(String clientPrefix)
    • supports

      public boolean supports(org.springframework.security.access.ConfigAttribute attribute)
      Specified by:
      supports in interface org.springframework.security.access.AccessDecisionVoter<Object>
    • supports

      public boolean supports(Class<?> clazz)
      This implementation supports any type of class, because it does not query the presented secure object.
      Specified by:
      supports in interface org.springframework.security.access.AccessDecisionVoter<Object>
      Parameters:
      clazz - the secure object
      Returns:
      always true
    • vote

      public int vote(org.springframework.security.core.Authentication authentication, Object object, Collection<org.springframework.security.access.ConfigAttribute> attributes)
      Specified by:
      vote in interface org.springframework.security.access.AccessDecisionVoter<Object>