Class DelegatingJwtGrantedAuthoritiesConverter

  • All Implemented Interfaces:
    org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,​java.util.Collection<org.springframework.security.core.GrantedAuthority>>

    public class DelegatingJwtGrantedAuthoritiesConverter
    extends java.lang.Object
    implements org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,​java.util.Collection<org.springframework.security.core.GrantedAuthority>>
    A Jwt to GrantedAuthority Converter that is a composite of converters.
    Since:
    5.5
    See Also:
    JwtGrantedAuthoritiesConverter
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<org.springframework.security.core.GrantedAuthority> convert​(org.springframework.security.oauth2.jwt.Jwt jwt)
      Extract GrantedAuthoritys from the given Jwt.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.springframework.core.convert.converter.Converter

        andThen
    • Constructor Detail

      • DelegatingJwtGrantedAuthoritiesConverter

        public DelegatingJwtGrantedAuthoritiesConverter​(java.util.Collection<org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,​java.util.Collection<org.springframework.security.core.GrantedAuthority>>> authoritiesConverters)
        Constructs a DelegatingJwtGrantedAuthoritiesConverter using the provided Collection of Converters
        Parameters:
        authoritiesConverters - the Collection of Converters to use
      • DelegatingJwtGrantedAuthoritiesConverter

        @SafeVarargs
        public DelegatingJwtGrantedAuthoritiesConverter​(org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,​java.util.Collection<org.springframework.security.core.GrantedAuthority>>... authoritiesConverters)
        Constructs a DelegatingJwtGrantedAuthoritiesConverter using the provided array of Converters
        Parameters:
        authoritiesConverters - the array of Converters to use
    • Method Detail

      • convert

        public java.util.Collection<org.springframework.security.core.GrantedAuthority> convert​(org.springframework.security.oauth2.jwt.Jwt jwt)
        Extract GrantedAuthoritys from the given Jwt.

        The authorities are extracted from each delegated Converter one at a time. For each converter, its authorities are added in order, with duplicates removed.

        Specified by:
        convert in interface org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,​java.util.Collection<org.springframework.security.core.GrantedAuthority>>
        Parameters:
        jwt - The Jwt token
        Returns:
        The authorities read from the token scopes