Search in sources :

Example 1 with OAuth2TokenClaimsContext

use of org.springframework.security.oauth2.server.authorization.OAuth2TokenClaimsContext in project spring-authorization-server by spring-projects.

the class OAuth2ConfigurerUtils method getTokenGenerator.

@SuppressWarnings("unchecked")
static <B extends HttpSecurityBuilder<B>> OAuth2TokenGenerator<? extends OAuth2Token> getTokenGenerator(B builder) {
    OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator = builder.getSharedObject(OAuth2TokenGenerator.class);
    if (tokenGenerator == null) {
        tokenGenerator = getOptionalBean(builder, OAuth2TokenGenerator.class);
        if (tokenGenerator == null) {
            JwtGenerator jwtGenerator = getJwtGenerator(builder);
            OAuth2AccessTokenGenerator accessTokenGenerator = new OAuth2AccessTokenGenerator();
            OAuth2TokenCustomizer<OAuth2TokenClaimsContext> accessTokenCustomizer = getAccessTokenCustomizer(builder);
            if (accessTokenCustomizer != null) {
                accessTokenGenerator.setAccessTokenCustomizer(accessTokenCustomizer);
            }
            OAuth2RefreshTokenGenerator refreshTokenGenerator = new OAuth2RefreshTokenGenerator();
            if (jwtGenerator != null) {
                tokenGenerator = new DelegatingOAuth2TokenGenerator(jwtGenerator, accessTokenGenerator, refreshTokenGenerator);
            } else {
                tokenGenerator = new DelegatingOAuth2TokenGenerator(accessTokenGenerator, refreshTokenGenerator);
            }
        }
        builder.setSharedObject(OAuth2TokenGenerator.class, tokenGenerator);
    }
    return tokenGenerator;
}
Also used : JwtGenerator(org.springframework.security.oauth2.server.authorization.JwtGenerator) OAuth2RefreshTokenGenerator(org.springframework.security.oauth2.server.authorization.OAuth2RefreshTokenGenerator) OAuth2TokenGenerator(org.springframework.security.oauth2.server.authorization.OAuth2TokenGenerator) DelegatingOAuth2TokenGenerator(org.springframework.security.oauth2.server.authorization.DelegatingOAuth2TokenGenerator) OAuth2TokenClaimsContext(org.springframework.security.oauth2.server.authorization.OAuth2TokenClaimsContext) OAuth2AccessTokenGenerator(org.springframework.security.oauth2.server.authorization.OAuth2AccessTokenGenerator) DelegatingOAuth2TokenGenerator(org.springframework.security.oauth2.server.authorization.DelegatingOAuth2TokenGenerator)

Example 2 with OAuth2TokenClaimsContext

use of org.springframework.security.oauth2.server.authorization.OAuth2TokenClaimsContext in project spring-authorization-server by spring-projects.

the class OAuth2AccessTokenGenerator method generate.

@Nullable
@Override
public OAuth2AccessToken generate(OAuth2TokenContext context) {
    if (!OAuth2TokenType.ACCESS_TOKEN.equals(context.getTokenType()) || !OAuth2TokenFormat.REFERENCE.equals(context.getRegisteredClient().getTokenSettings().getAccessTokenFormat())) {
        return null;
    }
    String issuer = null;
    if (context.getProviderContext() != null) {
        issuer = context.getProviderContext().getIssuer();
    }
    RegisteredClient registeredClient = context.getRegisteredClient();
    Instant issuedAt = Instant.now();
    Instant expiresAt = issuedAt.plus(registeredClient.getTokenSettings().getAccessTokenTimeToLive());
    // @formatter:off
    OAuth2TokenClaimsSet.Builder claimsBuilder = OAuth2TokenClaimsSet.builder();
    if (StringUtils.hasText(issuer)) {
        claimsBuilder.issuer(issuer);
    }
    claimsBuilder.subject(context.getPrincipal().getName()).audience(Collections.singletonList(registeredClient.getClientId())).issuedAt(issuedAt).expiresAt(expiresAt).notBefore(issuedAt).id(UUID.randomUUID().toString());
    if (!CollectionUtils.isEmpty(context.getAuthorizedScopes())) {
        claimsBuilder.claim(OAuth2ParameterNames.SCOPE, context.getAuthorizedScopes());
    }
    if (this.accessTokenCustomizer != null) {
        // @formatter:off
        OAuth2TokenClaimsContext.Builder accessTokenContextBuilder = OAuth2TokenClaimsContext.with(claimsBuilder).registeredClient(context.getRegisteredClient()).principal(context.getPrincipal()).providerContext(context.getProviderContext()).authorizedScopes(context.getAuthorizedScopes()).tokenType(context.getTokenType()).authorizationGrantType(context.getAuthorizationGrantType());
        if (context.getAuthorization() != null) {
            accessTokenContextBuilder.authorization(context.getAuthorization());
        }
        if (context.getAuthorizationGrant() != null) {
            accessTokenContextBuilder.authorizationGrant(context.getAuthorizationGrant());
        }
        // @formatter:on
        OAuth2TokenClaimsContext accessTokenContext = accessTokenContextBuilder.build();
        this.accessTokenCustomizer.customize(accessTokenContext);
    }
    OAuth2TokenClaimsSet accessTokenClaimsSet = claimsBuilder.build();
    OAuth2AccessToken accessToken = new OAuth2AccessTokenClaims(OAuth2AccessToken.TokenType.BEARER, this.accessTokenGenerator.generateKey(), accessTokenClaimsSet.getIssuedAt(), accessTokenClaimsSet.getExpiresAt(), context.getAuthorizedScopes(), accessTokenClaimsSet.getClaims());
    return accessToken;
}
Also used : OAuth2TokenClaimsSet(org.springframework.security.oauth2.core.OAuth2TokenClaimsSet) OAuth2AccessToken(org.springframework.security.oauth2.core.OAuth2AccessToken) Instant(java.time.Instant) RegisteredClient(org.springframework.security.oauth2.server.authorization.client.RegisteredClient) Nullable(org.springframework.lang.Nullable)

Example 3 with OAuth2TokenClaimsContext

use of org.springframework.security.oauth2.server.authorization.OAuth2TokenClaimsContext in project spring-authorization-server by spring-projects.

the class OAuth2TokenIntrospectionTests method requestWhenObtainReferenceAccessTokenAndIntrospectThenActive.

@Test
public void requestWhenObtainReferenceAccessTokenAndIntrospectThenActive() throws Exception {
    this.spring.register(AuthorizationServerConfiguration.class).autowire();
    // @formatter:off
    TokenSettings tokenSettings = TokenSettings.builder().accessTokenFormat(OAuth2TokenFormat.REFERENCE).build();
    RegisteredClient authorizedRegisteredClient = TestRegisteredClients.registeredClient().tokenSettings(tokenSettings).build();
    // @formatter:on
    this.registeredClientRepository.save(authorizedRegisteredClient);
    OAuth2Authorization authorization = TestOAuth2Authorizations.authorization(authorizedRegisteredClient).build();
    this.authorizationService.save(authorization);
    // @formatter:off
    MvcResult mvcResult = this.mvc.perform(post(providerSettings.getTokenEndpoint()).params(getAuthorizationCodeTokenRequestParameters(authorizedRegisteredClient, authorization)).header(HttpHeaders.AUTHORIZATION, getAuthorizationHeader(authorizedRegisteredClient))).andExpect(status().isOk()).andReturn();
    // @formatter:on
    OAuth2AccessTokenResponse accessTokenResponse = readAccessTokenResponse(mvcResult);
    OAuth2AccessToken accessToken = accessTokenResponse.getAccessToken();
    RegisteredClient introspectRegisteredClient = TestRegisteredClients.registeredClient2().build();
    this.registeredClientRepository.save(introspectRegisteredClient);
    // @formatter:off
    mvcResult = this.mvc.perform(post(providerSettings.getTokenIntrospectionEndpoint()).params(getTokenIntrospectionRequestParameters(accessToken, OAuth2TokenType.ACCESS_TOKEN)).header(HttpHeaders.AUTHORIZATION, getAuthorizationHeader(introspectRegisteredClient))).andExpect(status().isOk()).andReturn();
    // @formatter:on
    OAuth2TokenIntrospection tokenIntrospectionResponse = readTokenIntrospectionResponse(mvcResult);
    ArgumentCaptor<OAuth2TokenClaimsContext> accessTokenClaimsContextCaptor = ArgumentCaptor.forClass(OAuth2TokenClaimsContext.class);
    verify(accessTokenCustomizer).customize(accessTokenClaimsContextCaptor.capture());
    OAuth2TokenClaimsContext accessTokenClaimsContext = accessTokenClaimsContextCaptor.getValue();
    OAuth2TokenClaimsSet accessTokenClaims = accessTokenClaimsContext.getClaims().build();
    assertThat(tokenIntrospectionResponse.isActive()).isTrue();
    assertThat(tokenIntrospectionResponse.getClientId()).isEqualTo(authorizedRegisteredClient.getClientId());
    assertThat(tokenIntrospectionResponse.getUsername()).isNull();
    assertThat(tokenIntrospectionResponse.getIssuedAt()).isBetween(accessTokenClaims.getIssuedAt().minusSeconds(1), accessTokenClaims.getIssuedAt().plusSeconds(1));
    assertThat(tokenIntrospectionResponse.getExpiresAt()).isBetween(accessTokenClaims.getExpiresAt().minusSeconds(1), accessTokenClaims.getExpiresAt().plusSeconds(1));
    List<String> scopes = new ArrayList<>(accessTokenClaims.getClaim(OAuth2ParameterNames.SCOPE));
    assertThat(tokenIntrospectionResponse.getScopes()).containsExactlyInAnyOrderElementsOf(scopes);
    assertThat(tokenIntrospectionResponse.getTokenType()).isEqualTo(accessToken.getTokenType().getValue());
    assertThat(tokenIntrospectionResponse.getNotBefore()).isBetween(accessTokenClaims.getNotBefore().minusSeconds(1), accessTokenClaims.getNotBefore().plusSeconds(1));
    assertThat(tokenIntrospectionResponse.getSubject()).isEqualTo(accessTokenClaims.getSubject());
    assertThat(tokenIntrospectionResponse.getAudience()).containsExactlyInAnyOrderElementsOf(accessTokenClaims.getAudience());
    assertThat(tokenIntrospectionResponse.getIssuer()).isEqualTo(accessTokenClaims.getIssuer());
    assertThat(tokenIntrospectionResponse.getId()).isEqualTo(accessTokenClaims.getId());
}
Also used : OAuth2AccessTokenResponse(org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse) OAuth2TokenIntrospection(org.springframework.security.oauth2.core.OAuth2TokenIntrospection) OAuth2TokenClaimsContext(org.springframework.security.oauth2.server.authorization.OAuth2TokenClaimsContext) TokenSettings(org.springframework.security.oauth2.server.authorization.config.TokenSettings) ArrayList(java.util.ArrayList) OAuth2Authorization(org.springframework.security.oauth2.server.authorization.OAuth2Authorization) MvcResult(org.springframework.test.web.servlet.MvcResult) OAuth2AuthorizationServerConfiguration(org.springframework.security.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration) RegisteredClient(org.springframework.security.oauth2.server.authorization.client.RegisteredClient) OAuth2AccessToken(org.springframework.security.oauth2.core.OAuth2AccessToken) OAuth2TokenClaimsSet(org.springframework.security.oauth2.core.OAuth2TokenClaimsSet) Test(org.junit.Test)

Example 4 with OAuth2TokenClaimsContext

use of org.springframework.security.oauth2.server.authorization.OAuth2TokenClaimsContext in project spring-authorization-server by spring-projects.

the class OAuth2TokenClaimsContextTests method buildWhenAllValuesProvidedThenAllValuesAreSet.

@Test
public void buildWhenAllValuesProvidedThenAllValuesAreSet() {
    String issuer = "https://provider.com";
    Instant issuedAt = Instant.now();
    Instant expiresAt = issuedAt.plus(1, ChronoUnit.HOURS);
    // @formatter:off
    OAuth2TokenClaimsSet.Builder claims = OAuth2TokenClaimsSet.builder().issuer(issuer).subject("subject").audience(Collections.singletonList("client-1")).issuedAt(issuedAt).notBefore(issuedAt).expiresAt(expiresAt).id("id");
    // @formatter:on
    RegisteredClient registeredClient = TestRegisteredClients.registeredClient().build();
    OAuth2Authorization authorization = TestOAuth2Authorizations.authorization(registeredClient).build();
    Authentication principal = authorization.getAttribute(Principal.class.getName());
    ProviderSettings providerSettings = ProviderSettings.builder().issuer(issuer).build();
    ProviderContext providerContext = new ProviderContext(providerSettings, null);
    OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient, ClientAuthenticationMethod.CLIENT_SECRET_BASIC, registeredClient.getClientSecret());
    OAuth2AuthorizationRequest authorizationRequest = authorization.getAttribute(OAuth2AuthorizationRequest.class.getName());
    OAuth2AuthorizationCodeAuthenticationToken authorizationGrant = new OAuth2AuthorizationCodeAuthenticationToken("code", clientPrincipal, authorizationRequest.getRedirectUri(), null);
    // @formatter:off
    OAuth2TokenClaimsContext context = OAuth2TokenClaimsContext.with(claims).registeredClient(registeredClient).principal(principal).providerContext(providerContext).authorization(authorization).tokenType(OAuth2TokenType.ACCESS_TOKEN).authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE).authorizationGrant(authorizationGrant).put("custom-key-1", "custom-value-1").context(ctx -> ctx.put("custom-key-2", "custom-value-2")).build();
    // @formatter:on
    assertThat(context.getClaims()).isEqualTo(claims);
    assertThat(context.getRegisteredClient()).isEqualTo(registeredClient);
    assertThat(context.<Authentication>getPrincipal()).isEqualTo(principal);
    assertThat(context.getProviderContext()).isEqualTo(providerContext);
    assertThat(context.getAuthorization()).isEqualTo(authorization);
    assertThat(context.getTokenType()).isEqualTo(OAuth2TokenType.ACCESS_TOKEN);
    assertThat(context.getAuthorizationGrantType()).isEqualTo(AuthorizationGrantType.AUTHORIZATION_CODE);
    assertThat(context.<OAuth2AuthorizationGrantAuthenticationToken>getAuthorizationGrant()).isEqualTo(authorizationGrant);
    assertThat(context.<String>get("custom-key-1")).isEqualTo("custom-value-1");
    assertThat(context.<String>get("custom-key-2")).isEqualTo("custom-value-2");
}
Also used : ProviderSettings(org.springframework.security.oauth2.server.authorization.config.ProviderSettings) RegisteredClient(org.springframework.security.oauth2.server.authorization.client.RegisteredClient) OAuth2AuthorizationGrantAuthenticationToken(org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationGrantAuthenticationToken) OAuth2TokenClaimsSet(org.springframework.security.oauth2.core.OAuth2TokenClaimsSet) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) OAuth2AuthorizationRequest(org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest) OAuth2ClientAuthenticationToken(org.springframework.security.oauth2.server.authorization.authentication.OAuth2ClientAuthenticationToken) Test(org.junit.Test) Instant(java.time.Instant) OAuth2AuthorizationCodeAuthenticationToken(org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeAuthenticationToken) TestRegisteredClients(org.springframework.security.oauth2.server.authorization.client.TestRegisteredClients) Principal(java.security.Principal) ChronoUnit(java.time.temporal.ChronoUnit) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) ClientAuthenticationMethod(org.springframework.security.oauth2.core.ClientAuthenticationMethod) OAuth2TokenType(org.springframework.security.oauth2.core.OAuth2TokenType) ProviderContext(org.springframework.security.oauth2.server.authorization.context.ProviderContext) Authentication(org.springframework.security.core.Authentication) Collections(java.util.Collections) AuthorizationGrantType(org.springframework.security.oauth2.core.AuthorizationGrantType) ProviderContext(org.springframework.security.oauth2.server.authorization.context.ProviderContext) Instant(java.time.Instant) ProviderSettings(org.springframework.security.oauth2.server.authorization.config.ProviderSettings) OAuth2AuthorizationCodeAuthenticationToken(org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeAuthenticationToken) RegisteredClient(org.springframework.security.oauth2.server.authorization.client.RegisteredClient) OAuth2TokenClaimsSet(org.springframework.security.oauth2.core.OAuth2TokenClaimsSet) Authentication(org.springframework.security.core.Authentication) OAuth2AuthorizationGrantAuthenticationToken(org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationGrantAuthenticationToken) OAuth2ClientAuthenticationToken(org.springframework.security.oauth2.server.authorization.authentication.OAuth2ClientAuthenticationToken) OAuth2AuthorizationRequest(org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest) Principal(java.security.Principal) Test(org.junit.Test)

Example 5 with OAuth2TokenClaimsContext

use of org.springframework.security.oauth2.server.authorization.OAuth2TokenClaimsContext in project spring-authorization-server by spring-projects.

the class OAuth2AccessTokenGeneratorTests method generateWhenReferenceAccessTokenTypeThenReturnAccessToken.

@Test
public void generateWhenReferenceAccessTokenTypeThenReturnAccessToken() {
    // @formatter:off
    TokenSettings tokenSettings = TokenSettings.builder().accessTokenFormat(OAuth2TokenFormat.REFERENCE).build();
    RegisteredClient registeredClient = TestRegisteredClients.registeredClient().tokenSettings(tokenSettings).build();
    // @formatter:on
    OAuth2Authorization authorization = TestOAuth2Authorizations.authorization(registeredClient).build();
    Authentication principal = authorization.getAttribute(Principal.class.getName());
    OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient, ClientAuthenticationMethod.CLIENT_SECRET_BASIC, registeredClient.getClientSecret());
    OAuth2AuthorizationRequest authorizationRequest = authorization.getAttribute(OAuth2AuthorizationRequest.class.getName());
    OAuth2AuthorizationCodeAuthenticationToken authentication = new OAuth2AuthorizationCodeAuthenticationToken("code", clientPrincipal, authorizationRequest.getRedirectUri(), null);
    // @formatter:off
    OAuth2TokenContext tokenContext = DefaultOAuth2TokenContext.builder().registeredClient(registeredClient).principal(principal).providerContext(this.providerContext).authorization(authorization).authorizedScopes(authorization.getAttribute(OAuth2Authorization.AUTHORIZED_SCOPE_ATTRIBUTE_NAME)).tokenType(OAuth2TokenType.ACCESS_TOKEN).authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE).authorizationGrant(authentication).build();
    // @formatter:on
    OAuth2AccessToken accessToken = this.accessTokenGenerator.generate(tokenContext);
    assertThat(accessToken).isNotNull();
    Instant issuedAt = Instant.now();
    Instant expiresAt = issuedAt.plus(tokenContext.getRegisteredClient().getTokenSettings().getAccessTokenTimeToLive());
    assertThat(accessToken.getIssuedAt()).isBetween(issuedAt.minusSeconds(1), issuedAt.plusSeconds(1));
    assertThat(accessToken.getExpiresAt()).isBetween(expiresAt.minusSeconds(1), expiresAt.plusSeconds(1));
    assertThat(accessToken.getScopes()).isEqualTo(tokenContext.getAuthorizedScopes());
    assertThat(accessToken).isInstanceOf(ClaimAccessor.class);
    OAuth2TokenClaimAccessor accessTokenClaims = ((ClaimAccessor) accessToken)::getClaims;
    assertThat(accessTokenClaims.getClaims()).isNotEmpty();
    assertThat(accessTokenClaims.getIssuer().toExternalForm()).isEqualTo(tokenContext.getProviderContext().getIssuer());
    assertThat(accessTokenClaims.getSubject()).isEqualTo(tokenContext.getPrincipal().getName());
    assertThat(accessTokenClaims.getAudience()).isEqualTo(Collections.singletonList(tokenContext.getRegisteredClient().getClientId()));
    assertThat(accessTokenClaims.getIssuedAt()).isBetween(issuedAt.minusSeconds(1), issuedAt.plusSeconds(1));
    assertThat(accessTokenClaims.getExpiresAt()).isBetween(expiresAt.minusSeconds(1), expiresAt.plusSeconds(1));
    assertThat(accessTokenClaims.getNotBefore()).isBetween(issuedAt.minusSeconds(1), issuedAt.plusSeconds(1));
    assertThat(accessTokenClaims.getId()).isNotNull();
    Set<String> scopes = accessTokenClaims.getClaim(OAuth2ParameterNames.SCOPE);
    assertThat(scopes).isEqualTo(tokenContext.getAuthorizedScopes());
    ArgumentCaptor<OAuth2TokenClaimsContext> tokenClaimsContextCaptor = ArgumentCaptor.forClass(OAuth2TokenClaimsContext.class);
    verify(this.accessTokenCustomizer).customize(tokenClaimsContextCaptor.capture());
    OAuth2TokenClaimsContext tokenClaimsContext = tokenClaimsContextCaptor.getValue();
    assertThat(tokenClaimsContext.getClaims()).isNotNull();
    assertThat(tokenClaimsContext.getRegisteredClient()).isEqualTo(tokenContext.getRegisteredClient());
    assertThat(tokenClaimsContext.<Authentication>getPrincipal()).isEqualTo(tokenContext.getPrincipal());
    assertThat(tokenClaimsContext.getProviderContext()).isEqualTo(tokenContext.getProviderContext());
    assertThat(tokenClaimsContext.getAuthorization()).isEqualTo(tokenContext.getAuthorization());
    assertThat(tokenClaimsContext.getAuthorizedScopes()).isEqualTo(tokenContext.getAuthorizedScopes());
    assertThat(tokenClaimsContext.getTokenType()).isEqualTo(tokenContext.getTokenType());
    assertThat(tokenClaimsContext.getAuthorizationGrantType()).isEqualTo(tokenContext.getAuthorizationGrantType());
    assertThat(tokenClaimsContext.<Authentication>getAuthorizationGrant()).isEqualTo(tokenContext.getAuthorizationGrant());
}
Also used : TokenSettings(org.springframework.security.oauth2.server.authorization.config.TokenSettings) Instant(java.time.Instant) OAuth2AuthorizationCodeAuthenticationToken(org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeAuthenticationToken) RegisteredClient(org.springframework.security.oauth2.server.authorization.client.RegisteredClient) OAuth2TokenClaimAccessor(org.springframework.security.oauth2.core.OAuth2TokenClaimAccessor) ClaimAccessor(org.springframework.security.oauth2.core.ClaimAccessor) Authentication(org.springframework.security.core.Authentication) OAuth2AccessToken(org.springframework.security.oauth2.core.OAuth2AccessToken) OAuth2TokenClaimAccessor(org.springframework.security.oauth2.core.OAuth2TokenClaimAccessor) OAuth2ClientAuthenticationToken(org.springframework.security.oauth2.server.authorization.authentication.OAuth2ClientAuthenticationToken) OAuth2AuthorizationRequest(org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest) Principal(java.security.Principal) Test(org.junit.Test)

Aggregations

RegisteredClient (org.springframework.security.oauth2.server.authorization.client.RegisteredClient)4 Instant (java.time.Instant)3 Test (org.junit.Test)3 OAuth2AccessToken (org.springframework.security.oauth2.core.OAuth2AccessToken)3 OAuth2TokenClaimsSet (org.springframework.security.oauth2.core.OAuth2TokenClaimsSet)3 Principal (java.security.Principal)2 Authentication (org.springframework.security.core.Authentication)2 OAuth2AuthorizationRequest (org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest)2 OAuth2TokenClaimsContext (org.springframework.security.oauth2.server.authorization.OAuth2TokenClaimsContext)2 OAuth2AuthorizationCodeAuthenticationToken (org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeAuthenticationToken)2 OAuth2ClientAuthenticationToken (org.springframework.security.oauth2.server.authorization.authentication.OAuth2ClientAuthenticationToken)2 TokenSettings (org.springframework.security.oauth2.server.authorization.config.TokenSettings)2 ChronoUnit (java.time.temporal.ChronoUnit)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)1 Nullable (org.springframework.lang.Nullable)1 OAuth2AuthorizationServerConfiguration (org.springframework.security.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration)1 AuthorizationGrantType (org.springframework.security.oauth2.core.AuthorizationGrantType)1