From 4dbbcabacfe821221c5d01b22030a9a6a20eaf5e Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Tue, 24 Oct 2017 15:21:15 -0400 Subject: [PATCH] Rename AuthorizationCodeAuthenticationProvider -> OAuth2LoginAuthenticationProvider Fixes gh-4690 --- .../oauth2/client/OAuth2LoginConfigurer.java | 12 ++++++------ ...r.java => OAuth2LoginAuthenticationProvider.java} | 4 ++-- .../client/web/OAuth2LoginAuthenticationFilter.java | 6 +++--- .../OidcAuthorizationCodeAuthenticationProvider.java | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) rename oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/authentication/{AuthorizationCodeAuthenticationProvider.java => OAuth2LoginAuthenticationProvider.java} (98%) diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java index bb0455d99e..935599dcc7 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java @@ -20,7 +20,7 @@ import org.springframework.core.ResolvableType; import org.springframework.security.config.annotation.web.HttpSecurityBuilder; import org.springframework.security.config.annotation.web.configurers.AbstractAuthenticationFilterConfigurer; import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; -import org.springframework.security.oauth2.client.authentication.AuthorizationCodeAuthenticationProvider; +import org.springframework.security.oauth2.client.authentication.OAuth2LoginAuthenticationProvider; import org.springframework.security.oauth2.client.authentication.AuthorizationCodeAuthenticationToken; import org.springframework.security.oauth2.client.authentication.AuthorizationGrantTokenExchanger; import org.springframework.security.oauth2.client.authentication.NimbusAuthorizationCodeTokenExchanger; @@ -247,17 +247,17 @@ public final class OAuth2LoginConfigurer> exten jwtDecoderRegistry = new NimbusJwtDecoderRegistry(); } - AuthorizationCodeAuthenticationProvider oauth2AuthorizationCodeAuthenticationProvider = - new AuthorizationCodeAuthenticationProvider(authorizationCodeTokenExchanger, oauth2UserService); + OAuth2LoginAuthenticationProvider oauth2LoginAuthenticationProvider = + new OAuth2LoginAuthenticationProvider(authorizationCodeTokenExchanger, oauth2UserService); if (this.tokenEndpointConfig.accessTokenRepository != null) { - oauth2AuthorizationCodeAuthenticationProvider.setAccessTokenRepository( + oauth2LoginAuthenticationProvider.setAccessTokenRepository( this.tokenEndpointConfig.accessTokenRepository); } if (this.userInfoEndpointConfig.userAuthoritiesMapper != null) { - oauth2AuthorizationCodeAuthenticationProvider.setAuthoritiesMapper( + oauth2LoginAuthenticationProvider.setAuthoritiesMapper( this.userInfoEndpointConfig.userAuthoritiesMapper); } - http.authenticationProvider(this.postProcess(oauth2AuthorizationCodeAuthenticationProvider)); + http.authenticationProvider(this.postProcess(oauth2LoginAuthenticationProvider)); OAuth2UserService oidcUserService = this.userInfoEndpointConfig.userService; if (oidcUserService == null) { diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/authentication/AuthorizationCodeAuthenticationProvider.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationProvider.java similarity index 98% rename from oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/authentication/AuthorizationCodeAuthenticationProvider.java rename to oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationProvider.java index 0ec311859c..bd5098c976 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/authentication/AuthorizationCodeAuthenticationProvider.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationProvider.java @@ -58,7 +58,7 @@ import java.util.Collection; * @see Section 4.1.3 Access Token Request * @see Section 4.1.4 Access Token Response */ -public class AuthorizationCodeAuthenticationProvider implements AuthenticationProvider { +public class OAuth2LoginAuthenticationProvider implements AuthenticationProvider { private static final String INVALID_STATE_PARAMETER_ERROR_CODE = "invalid_state_parameter"; private static final String INVALID_REDIRECT_URI_PARAMETER_ERROR_CODE = "invalid_redirect_uri_parameter"; private final AuthorizationGrantTokenExchanger authorizationCodeTokenExchanger; @@ -66,7 +66,7 @@ public class AuthorizationCodeAuthenticationProvider implements AuthenticationPr private SecurityTokenRepository accessTokenRepository = new InMemoryAccessTokenRepository(); private GrantedAuthoritiesMapper authoritiesMapper = (authorities -> authorities); - public AuthorizationCodeAuthenticationProvider( + public OAuth2LoginAuthenticationProvider( AuthorizationGrantTokenExchanger authorizationCodeTokenExchanger, OAuth2UserService userService) { diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilter.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilter.java index 35b296d40b..f4a8d927c1 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilter.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilter.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.client.web; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; -import org.springframework.security.oauth2.client.authentication.AuthorizationCodeAuthenticationProvider; +import org.springframework.security.oauth2.client.authentication.OAuth2LoginAuthenticationProvider; import org.springframework.security.oauth2.client.authentication.AuthorizationCodeAuthenticationToken; import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationException; import org.springframework.security.oauth2.client.registration.ClientRegistration; @@ -55,7 +55,7 @@ import java.io.IOException; *
  • * This Filter will then create an {@link AuthorizationCodeAuthenticationToken} with * the {@link OAuth2Parameter#CODE} received in the previous step and delegate it to - * {@link AuthorizationCodeAuthenticationProvider#authenticate(Authentication)} (indirectly via {@link AuthenticationManager}). + * {@link OAuth2LoginAuthenticationProvider#authenticate(Authentication)} (indirectly via {@link AuthenticationManager}). *
  • * * @@ -63,7 +63,7 @@ import java.io.IOException; * @since 5.0 * @see AbstractAuthenticationProcessingFilter * @see AuthorizationCodeAuthenticationToken - * @see AuthorizationCodeAuthenticationProvider + * @see OAuth2LoginAuthenticationProvider * @see AuthorizationResponse * @see AuthorizationRequest * @see AuthorizationRequestRepository diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/oidc/client/authentication/OidcAuthorizationCodeAuthenticationProvider.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/oidc/client/authentication/OidcAuthorizationCodeAuthenticationProvider.java index 42cd675585..24bf0b7ea1 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/oidc/client/authentication/OidcAuthorizationCodeAuthenticationProvider.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/oidc/client/authentication/OidcAuthorizationCodeAuthenticationProvider.java @@ -102,7 +102,7 @@ public class OidcAuthorizationCodeAuthenticationProvider implements Authenticati if (!authorizationCodeAuthentication.getAuthorizationExchange() .getAuthorizationRequest().getScopes().contains(OidcScope.OPENID)) { // This is NOT an OpenID Connect Authentication Request so return null - // and let AuthorizationCodeAuthenticationProvider handle it instead + // and let OAuth2LoginAuthenticationProvider handle it instead return null; }