Class AadJwtBearerTokenAuthenticationConverter

  • All Implemented Interfaces:
    org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,​org.springframework.security.authentication.AbstractAuthenticationToken>

    public class AadJwtBearerTokenAuthenticationConverter
    extends Object
    implements org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,​org.springframework.security.authentication.AbstractAuthenticationToken>
    A Converter that takes a Jwt and converts it into a BearerTokenAuthentication.
    • Constructor Detail

      • AadJwtBearerTokenAuthenticationConverter

        public AadJwtBearerTokenAuthenticationConverter()
        Construct AADJwtBearerTokenAuthenticationConverter by AADTokenClaim.SUB and DEFAULT_CLAIM_TO_AUTHORITY_PREFIX_MAP.
      • AadJwtBearerTokenAuthenticationConverter

        public AadJwtBearerTokenAuthenticationConverter​(String authoritiesClaimName)
        Construct AADJwtBearerTokenAuthenticationConverter with the authority claim.
        Parameters:
        authoritiesClaimName - authority claim name
      • AadJwtBearerTokenAuthenticationConverter

        public AadJwtBearerTokenAuthenticationConverter​(String authoritiesClaimName,
                                                        String authorityPrefix)
        Construct AADJwtBearerTokenAuthenticationConverter with the authority claim name and prefix.
        Parameters:
        authoritiesClaimName - authority claim name
        authorityPrefix - the prefix name of the authority
      • AadJwtBearerTokenAuthenticationConverter

        public AadJwtBearerTokenAuthenticationConverter​(String principalClaimName,
                                                        Map<String,​String> claimToAuthorityPrefixMap)
        Using spring security provides JwtGrantedAuthoritiesConverter, it can resolve the access token of scp or roles.
        Parameters:
        principalClaimName - authorities claim name
        claimToAuthorityPrefixMap - the authority name and prefix map
    • Method Detail

      • convert

        public org.springframework.security.authentication.AbstractAuthenticationToken convert​(org.springframework.security.oauth2.jwt.Jwt jwt)
        Convert the source object of type Jwt to target type AbstractAuthenticationToken.
        Specified by:
        convert in interface org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,​org.springframework.security.authentication.AbstractAuthenticationToken>
        Parameters:
        jwt - the source object to convert, which must be an instance of Jwt (never null)
        Returns:
        the converted object