Change constructor param order in oauth2 client filters
Fixes gh-4818
This commit is contained in:
parent
1b70efce2b
commit
872a8f3189
|
@ -48,7 +48,7 @@ public final class ImplicitGrantConfigurer<B extends HttpSecurityBuilder<B>> ext
|
|||
@Override
|
||||
public void configure(B http) throws Exception {
|
||||
OAuth2AuthorizationRequestRedirectFilter authorizationRequestFilter = new OAuth2AuthorizationRequestRedirectFilter(
|
||||
this.getAuthorizationRequestBaseUri(), this.getClientRegistrationRepository());
|
||||
this.getClientRegistrationRepository(), this.getAuthorizationRequestBaseUri());
|
||||
http.addFilter(this.postProcess(authorizationRequestFilter));
|
||||
}
|
||||
|
||||
|
|
|
@ -218,9 +218,9 @@ public final class OAuth2LoginConfigurer<B extends HttpSecurityBuilder<B>> exten
|
|||
public void init(B http) throws Exception {
|
||||
OAuth2LoginAuthenticationFilter authenticationFilter =
|
||||
new OAuth2LoginAuthenticationFilter(
|
||||
OAuth2LoginAuthenticationFilter.DEFAULT_FILTER_PROCESSES_URI,
|
||||
this.getClientRegistrationRepository(),
|
||||
this.getAuthorizedClientService());
|
||||
this.getAuthorizedClientService(),
|
||||
OAuth2LoginAuthenticationFilter.DEFAULT_FILTER_PROCESSES_URI);
|
||||
this.setAuthenticationFilter(authenticationFilter);
|
||||
this.loginProcessingUrl(OAuth2LoginAuthenticationFilter.DEFAULT_FILTER_PROCESSES_URI);
|
||||
if (this.loginPage != null) {
|
||||
|
@ -285,7 +285,7 @@ public final class OAuth2LoginConfigurer<B extends HttpSecurityBuilder<B>> exten
|
|||
}
|
||||
|
||||
OAuth2AuthorizationRequestRedirectFilter authorizationRequestFilter = new OAuth2AuthorizationRequestRedirectFilter(
|
||||
authorizationRequestBaseUri, this.getClientRegistrationRepository());
|
||||
this.getClientRegistrationRepository(), authorizationRequestBaseUri);
|
||||
|
||||
if (this.authorizationEndpointConfig.authorizationRequestRepository != null) {
|
||||
authorizationRequestFilter.setAuthorizationRequestRepository(
|
||||
|
|
|
@ -75,11 +75,11 @@ public class OAuth2AuthorizationRequestRedirectFilter extends OncePerRequestFilt
|
|||
new HttpSessionOAuth2AuthorizationRequestRepository();
|
||||
|
||||
public OAuth2AuthorizationRequestRedirectFilter(ClientRegistrationRepository clientRegistrationRepository) {
|
||||
this(DEFAULT_AUTHORIZATION_REQUEST_BASE_URI, clientRegistrationRepository);
|
||||
this(clientRegistrationRepository, DEFAULT_AUTHORIZATION_REQUEST_BASE_URI);
|
||||
}
|
||||
|
||||
public OAuth2AuthorizationRequestRedirectFilter(
|
||||
String authorizationRequestBaseUri, ClientRegistrationRepository clientRegistrationRepository) {
|
||||
ClientRegistrationRepository clientRegistrationRepository, String authorizationRequestBaseUri) {
|
||||
|
||||
Assert.hasText(authorizationRequestBaseUri, "authorizationRequestBaseUri cannot be empty");
|
||||
Assert.notNull(clientRegistrationRepository, "clientRegistrationRepository cannot be null");
|
||||
|
|
|
@ -87,12 +87,12 @@ public class OAuth2LoginAuthenticationFilter extends AbstractAuthenticationProce
|
|||
|
||||
public OAuth2LoginAuthenticationFilter(ClientRegistrationRepository clientRegistrationRepository,
|
||||
OAuth2AuthorizedClientService authorizedClientService) {
|
||||
this(DEFAULT_FILTER_PROCESSES_URI, clientRegistrationRepository, authorizedClientService);
|
||||
this(clientRegistrationRepository, authorizedClientService, DEFAULT_FILTER_PROCESSES_URI);
|
||||
}
|
||||
|
||||
public OAuth2LoginAuthenticationFilter(String filterProcessesUrl,
|
||||
ClientRegistrationRepository clientRegistrationRepository,
|
||||
OAuth2AuthorizedClientService authorizedClientService) {
|
||||
public OAuth2LoginAuthenticationFilter(ClientRegistrationRepository clientRegistrationRepository,
|
||||
OAuth2AuthorizedClientService authorizedClientService,
|
||||
String filterProcessesUrl) {
|
||||
super(filterProcessesUrl);
|
||||
Assert.notNull(clientRegistrationRepository, "clientRegistrationRepository cannot be null");
|
||||
Assert.notNull(authorizedClientService, "authorizedClientService cannot be null");
|
||||
|
|
|
@ -99,7 +99,7 @@ public class OAuth2AuthorizationRequestRedirectFilterTests {
|
|||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void constructorWhenAuthorizationRequestBaseUriIsNullThenThrowIllegalArgumentException() {
|
||||
new OAuth2AuthorizationRequestRedirectFilter(null, this.clientRegistrationRepository);
|
||||
new OAuth2AuthorizationRequestRedirectFilter(this.clientRegistrationRepository, null);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
@ -231,7 +231,7 @@ public class OAuth2AuthorizationRequestRedirectFilterTests {
|
|||
@Test
|
||||
public void doFilterWhenCustomAuthorizationRequestBaseUriThenRedirectForAuthorization() throws Exception {
|
||||
String authorizationRequestBaseUri = "/custom/authorization";
|
||||
this.filter = new OAuth2AuthorizationRequestRedirectFilter(authorizationRequestBaseUri, this.clientRegistrationRepository);
|
||||
this.filter = new OAuth2AuthorizationRequestRedirectFilter(this.clientRegistrationRepository, authorizationRequestBaseUri);
|
||||
|
||||
String requestUri = authorizationRequestBaseUri + "/" + this.registration1.getRegistrationId();
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", requestUri);
|
||||
|
|
|
@ -128,7 +128,7 @@ public class OAuth2LoginAuthenticationFilterTests {
|
|||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void constructorWhenFilterProcessesUrlIsNullThenThrowIllegalArgumentException() {
|
||||
new OAuth2LoginAuthenticationFilter(null, this.clientRegistrationRepository, this.authorizedClientService);
|
||||
new OAuth2LoginAuthenticationFilter(this.clientRegistrationRepository, this.authorizedClientService, null);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
@ -241,8 +241,8 @@ public class OAuth2LoginAuthenticationFilterTests {
|
|||
@Test
|
||||
public void doFilterWhenCustomFilterProcessesUrlThenFilterProcesses() throws Exception {
|
||||
String filterProcessesUrl = "/login/oauth2/custom/*";
|
||||
this.filter = spy(new OAuth2LoginAuthenticationFilter(filterProcessesUrl,
|
||||
this.clientRegistrationRepository, this.authorizedClientService));
|
||||
this.filter = spy(new OAuth2LoginAuthenticationFilter(
|
||||
this.clientRegistrationRepository, this.authorizedClientService, filterProcessesUrl));
|
||||
this.filter.setAuthenticationManager(this.authenticationManager);
|
||||
|
||||
String requestUri = "/login/oauth2/custom/" + this.registration2.getRegistrationId();
|
||||
|
|
Loading…
Reference in New Issue