Class DelegatingJwtGrantedAuthoritiesConverter

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

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

      • DelegatingJwtGrantedAuthoritiesConverter

        public DelegatingJwtGrantedAuthoritiesConverter​(java.util.Collection<org.springframework.core.convert.converter.Converter<Jwt,​java.util.Collection<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<Jwt,​java.util.Collection<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<GrantedAuthority> convert​(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<Jwt,​java.util.Collection<GrantedAuthority>>
        Parameters:
        jwt - The Jwt token
        Returns:
        The authorities read from the token scopes