Rename to OidcAuthorizationCodeReactiveAuthenticationManager

Renamed OidcReactiveAuthenticationManager to
OidcAuthorizationCodeReactiveAuthenticationManager since it only handles
authorization code flow.

Fixes: gh-5530
This commit is contained in:
Rob Winch 2018-07-26 15:10:33 -05:00
parent 5f20bb3d50
commit 1c8a931e33
3 changed files with 10 additions and 10 deletions

View File

@ -46,7 +46,7 @@ import org.springframework.security.oauth2.client.InMemoryReactiveOAuth2Authoriz
import org.springframework.security.oauth2.client.ReactiveOAuth2AuthorizedClientService; import org.springframework.security.oauth2.client.ReactiveOAuth2AuthorizedClientService;
import org.springframework.security.oauth2.client.authentication.OAuth2LoginReactiveAuthenticationManager; import org.springframework.security.oauth2.client.authentication.OAuth2LoginReactiveAuthenticationManager;
import org.springframework.security.oauth2.client.endpoint.NimbusReactiveAuthorizationCodeTokenResponseClient; import org.springframework.security.oauth2.client.endpoint.NimbusReactiveAuthorizationCodeTokenResponseClient;
import org.springframework.security.oauth2.client.oidc.authentication.OidcReactiveAuthenticationManager; import org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizationCodeReactiveAuthenticationManager;
import org.springframework.security.oauth2.client.oidc.userinfo.OidcReactiveOAuth2UserService; import org.springframework.security.oauth2.client.oidc.userinfo.OidcReactiveOAuth2UserService;
import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository; import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository;
@ -382,7 +382,7 @@ public class ServerHttpSecurity {
boolean oidcAuthenticationProviderEnabled = ClassUtils.isPresent( boolean oidcAuthenticationProviderEnabled = ClassUtils.isPresent(
"org.springframework.security.oauth2.jwt.JwtDecoder", this.getClass().getClassLoader()); "org.springframework.security.oauth2.jwt.JwtDecoder", this.getClass().getClassLoader());
if (oidcAuthenticationProviderEnabled) { if (oidcAuthenticationProviderEnabled) {
OidcReactiveAuthenticationManager oidc = new OidcReactiveAuthenticationManager(client, new OidcReactiveOAuth2UserService(), authorizedClientService); OidcAuthorizationCodeReactiveAuthenticationManager oidc = new OidcAuthorizationCodeReactiveAuthenticationManager(client, new OidcReactiveOAuth2UserService(), authorizedClientService);
manager = new DelegatingReactiveAuthenticationManager(oidc, manager); manager = new DelegatingReactiveAuthenticationManager(oidc, manager);
} }

View File

@ -73,7 +73,7 @@ import java.util.function.Function;
* @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-4.1.3">Section 4.1.3 Access Token Request</a> * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-4.1.3">Section 4.1.3 Access Token Request</a>
* @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-4.1.4">Section 4.1.4 Access Token Response</a> * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-4.1.4">Section 4.1.4 Access Token Response</a>
*/ */
public class OidcReactiveAuthenticationManager implements public class OidcAuthorizationCodeReactiveAuthenticationManager implements
ReactiveAuthenticationManager { ReactiveAuthenticationManager {
private static final String INVALID_STATE_PARAMETER_ERROR_CODE = "invalid_state_parameter"; private static final String INVALID_STATE_PARAMETER_ERROR_CODE = "invalid_state_parameter";
@ -91,7 +91,7 @@ public class OidcReactiveAuthenticationManager implements
private Function<ClientRegistration, ReactiveJwtDecoder> decoderFactory = new DefaultDecoderFactory(); private Function<ClientRegistration, ReactiveJwtDecoder> decoderFactory = new DefaultDecoderFactory();
public OidcReactiveAuthenticationManager( public OidcAuthorizationCodeReactiveAuthenticationManager(
ReactiveOAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient, ReactiveOAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient,
ReactiveOAuth2UserService<OidcUserRequest, OidcUser> userService, ReactiveOAuth2UserService<OidcUserRequest, OidcUser> userService,
ReactiveOAuth2AuthorizedClientService authorizedClientService) { ReactiveOAuth2AuthorizedClientService authorizedClientService) {

View File

@ -65,7 +65,7 @@ import static org.mockito.Mockito.when;
* @since 5.1 * @since 5.1
*/ */
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class OidcReactiveAuthenticationManagerTests { public class OidcAuthorizationCodeReactiveAuthenticationManagerTests {
@Mock @Mock
private ReactiveOAuth2UserService<OidcUserRequest, OidcUser> userService; private ReactiveOAuth2UserService<OidcUserRequest, OidcUser> userService;
@ -99,11 +99,11 @@ public class OidcReactiveAuthenticationManagerTests {
private OidcIdToken idToken = new OidcIdToken("token123", Instant.now(), private OidcIdToken idToken = new OidcIdToken("token123", Instant.now(),
Instant.now().plusSeconds(3600), Collections.singletonMap(IdTokenClaimNames.SUB, "sub123")); Instant.now().plusSeconds(3600), Collections.singletonMap(IdTokenClaimNames.SUB, "sub123"));
private OidcReactiveAuthenticationManager manager; private OidcAuthorizationCodeReactiveAuthenticationManager manager;
@Before @Before
public void setup() { public void setup() {
this.manager = new OidcReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService, this.manager = new OidcAuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
this.authorizedClientService); this.authorizedClientService);
when(this.authorizedClientService.saveAuthorizedClient(any(), any())).thenReturn( when(this.authorizedClientService.saveAuthorizedClient(any(), any())).thenReturn(
Mono.empty()); Mono.empty());
@ -112,7 +112,7 @@ public class OidcReactiveAuthenticationManagerTests {
@Test @Test
public void constructorWhenNullAccessTokenResponseClientThenIllegalArgumentException() { public void constructorWhenNullAccessTokenResponseClientThenIllegalArgumentException() {
this.accessTokenResponseClient = null; this.accessTokenResponseClient = null;
assertThatThrownBy(() -> new OidcReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService, assertThatThrownBy(() -> new OidcAuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
this.authorizedClientService)) this.authorizedClientService))
.isInstanceOf(IllegalArgumentException.class); .isInstanceOf(IllegalArgumentException.class);
} }
@ -120,7 +120,7 @@ public class OidcReactiveAuthenticationManagerTests {
@Test @Test
public void constructorWhenNullUserServiceThenIllegalArgumentException() { public void constructorWhenNullUserServiceThenIllegalArgumentException() {
this.userService = null; this.userService = null;
assertThatThrownBy(() -> new OidcReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService, assertThatThrownBy(() -> new OidcAuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
this.authorizedClientService)) this.authorizedClientService))
.isInstanceOf(IllegalArgumentException.class); .isInstanceOf(IllegalArgumentException.class);
} }
@ -128,7 +128,7 @@ public class OidcReactiveAuthenticationManagerTests {
@Test @Test
public void constructorWhenNullAuthorizedClientServiceThenIllegalArgumentException() { public void constructorWhenNullAuthorizedClientServiceThenIllegalArgumentException() {
this.authorizedClientService = null; this.authorizedClientService = null;
assertThatThrownBy(() -> new OidcReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService, assertThatThrownBy(() -> new OidcAuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
this.authorizedClientService)) this.authorizedClientService))
.isInstanceOf(IllegalArgumentException.class); .isInstanceOf(IllegalArgumentException.class);
} }