Rename to OidcAuthorizationCodeReactiveAuthenticationManager
Renamed OidcReactiveAuthenticationManager to OidcAuthorizationCodeReactiveAuthenticationManager since it only handles authorization code flow. Fixes: gh-5530
This commit is contained in:
parent
5f20bb3d50
commit
1c8a931e33
|
@ -46,7 +46,7 @@ import org.springframework.security.oauth2.client.InMemoryReactiveOAuth2Authoriz
|
|||
import org.springframework.security.oauth2.client.ReactiveOAuth2AuthorizedClientService;
|
||||
import org.springframework.security.oauth2.client.authentication.OAuth2LoginReactiveAuthenticationManager;
|
||||
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.registration.ClientRegistration;
|
||||
import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository;
|
||||
|
@ -382,7 +382,7 @@ public class ServerHttpSecurity {
|
|||
boolean oidcAuthenticationProviderEnabled = ClassUtils.isPresent(
|
||||
"org.springframework.security.oauth2.jwt.JwtDecoder", this.getClass().getClassLoader());
|
||||
if (oidcAuthenticationProviderEnabled) {
|
||||
OidcReactiveAuthenticationManager oidc = new OidcReactiveAuthenticationManager(client, new OidcReactiveOAuth2UserService(), authorizedClientService);
|
||||
OidcAuthorizationCodeReactiveAuthenticationManager oidc = new OidcAuthorizationCodeReactiveAuthenticationManager(client, new OidcReactiveOAuth2UserService(), authorizedClientService);
|
||||
manager = new DelegatingReactiveAuthenticationManager(oidc, manager);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.4">Section 4.1.4 Access Token Response</a>
|
||||
*/
|
||||
public class OidcReactiveAuthenticationManager implements
|
||||
public class OidcAuthorizationCodeReactiveAuthenticationManager implements
|
||||
ReactiveAuthenticationManager {
|
||||
|
||||
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();
|
||||
|
||||
public OidcReactiveAuthenticationManager(
|
||||
public OidcAuthorizationCodeReactiveAuthenticationManager(
|
||||
ReactiveOAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient,
|
||||
ReactiveOAuth2UserService<OidcUserRequest, OidcUser> userService,
|
||||
ReactiveOAuth2AuthorizedClientService authorizedClientService) {
|
|
@ -65,7 +65,7 @@ import static org.mockito.Mockito.when;
|
|||
* @since 5.1
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class OidcReactiveAuthenticationManagerTests {
|
||||
public class OidcAuthorizationCodeReactiveAuthenticationManagerTests {
|
||||
@Mock
|
||||
private ReactiveOAuth2UserService<OidcUserRequest, OidcUser> userService;
|
||||
|
||||
|
@ -99,11 +99,11 @@ public class OidcReactiveAuthenticationManagerTests {
|
|||
private OidcIdToken idToken = new OidcIdToken("token123", Instant.now(),
|
||||
Instant.now().plusSeconds(3600), Collections.singletonMap(IdTokenClaimNames.SUB, "sub123"));
|
||||
|
||||
private OidcReactiveAuthenticationManager manager;
|
||||
private OidcAuthorizationCodeReactiveAuthenticationManager manager;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
this.manager = new OidcReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
|
||||
this.manager = new OidcAuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
|
||||
this.authorizedClientService);
|
||||
when(this.authorizedClientService.saveAuthorizedClient(any(), any())).thenReturn(
|
||||
Mono.empty());
|
||||
|
@ -112,7 +112,7 @@ public class OidcReactiveAuthenticationManagerTests {
|
|||
@Test
|
||||
public void constructorWhenNullAccessTokenResponseClientThenIllegalArgumentException() {
|
||||
this.accessTokenResponseClient = null;
|
||||
assertThatThrownBy(() -> new OidcReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
|
||||
assertThatThrownBy(() -> new OidcAuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
|
||||
this.authorizedClientService))
|
||||
.isInstanceOf(IllegalArgumentException.class);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class OidcReactiveAuthenticationManagerTests {
|
|||
@Test
|
||||
public void constructorWhenNullUserServiceThenIllegalArgumentException() {
|
||||
this.userService = null;
|
||||
assertThatThrownBy(() -> new OidcReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
|
||||
assertThatThrownBy(() -> new OidcAuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
|
||||
this.authorizedClientService))
|
||||
.isInstanceOf(IllegalArgumentException.class);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class OidcReactiveAuthenticationManagerTests {
|
|||
@Test
|
||||
public void constructorWhenNullAuthorizedClientServiceThenIllegalArgumentException() {
|
||||
this.authorizedClientService = null;
|
||||
assertThatThrownBy(() -> new OidcReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
|
||||
assertThatThrownBy(() -> new OidcAuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService,
|
||||
this.authorizedClientService))
|
||||
.isInstanceOf(IllegalArgumentException.class);
|
||||
}
|
Loading…
Reference in New Issue