Class ClientRestrictionTokenEnhancer

  • All Implemented Interfaces:
    org.springframework.security.oauth2.provider.token.TokenEnhancer

    public class ClientRestrictionTokenEnhancer
    extends Object
    implements org.springframework.security.oauth2.provider.token.TokenEnhancer
    • Method Detail

      • enhance

        public org.springframework.security.oauth2.common.OAuth2AccessToken enhance​(org.springframework.security.oauth2.common.OAuth2AccessToken accessToken,
                                                                                    org.springframework.security.oauth2.provider.OAuth2Authentication authentication)
        Specified by:
        enhance in interface org.springframework.security.oauth2.provider.token.TokenEnhancer
      • shouldEnhance

        protected boolean shouldEnhance​(org.springframework.security.oauth2.provider.OAuth2Authentication authentication)
      • addTenantProperties

        protected void addTenantProperties​(org.springframework.security.oauth2.common.DefaultOAuth2AccessToken enhancedToken,
                                           Optional<AuthorizationServer> maybeAuthServer)
      • getVendorRestrictionTargetsByType

        protected Map<String,​Set<String>> getVendorRestrictionTargetsByType​(Object vendorTargetsAttribute)
      • getRestrictedAuthoritiesInScopes

        protected Map<String,​Map<String,​Set<String>>> getRestrictedAuthoritiesInScopes​(Collection<org.springframework.security.core.GrantedAuthority> authorities,
                                                                                                   Set<String> scopes,
                                                                                                   Map<String,​Set<String>> restrictionTargetsByType)
        Gets the restricted authorities that are in scope. Since AuthorizedClient does not have any RestrictedPermission or RestrictedRole, the restricted_authorities claim is essentially all the authorities in scope mapped with its restrictions.
        Parameters:
        authorities - authorities to map the restrictions with
        scopes - requested scopes
        restrictionTargetsByType - restrictions to map the given authorities to
        Returns:
        a map of restricted authorities in the requested scopes