Fix OAuth2 client tests as per upstream changes

pull/10764/head
Madhura Bhave 7 years ago
parent 66b55defa0
commit 182b6f0d29

@ -111,7 +111,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
assertThat(adapted.getAuthorizationGrantType()).isEqualTo(
org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE);
assertThat(adapted.getRedirectUri()).isEqualTo(
"{scheme}://{serverName}:{serverPort}{contextPath}/login/oauth2/authorize/code/{registrationId}");
"{scheme}://{serverName}:{serverPort}{contextPath}/login/oauth2/{registrationId}");
assertThat(adapted.getScopes()).containsExactly("openid", "profile", "email",
"address", "phone");
assertThat(adapted.getClientName()).isEqualTo("Google");
@ -195,7 +195,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
assertThat(adapted.getAuthorizationGrantType()).isEqualTo(
org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE);
assertThat(adapted.getRedirectUri()).isEqualTo(
"{scheme}://{serverName}:{serverPort}{contextPath}/login/oauth2/authorize/code/{registrationId}");
"{scheme}://{serverName}:{serverPort}{contextPath}/login/oauth2/{registrationId}");
assertThat(adapted.getScopes()).containsExactly("openid", "profile", "email",
"address", "phone");
assertThat(adapted.getClientName()).isEqualTo("Google");

@ -35,8 +35,8 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository;
import org.springframework.security.oauth2.client.web.AuthorizationCodeAuthenticationFilter;
import org.springframework.security.oauth2.client.web.AuthorizationRequestRedirectFilter;
import org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter;
import org.springframework.security.oauth2.core.AuthorizationGrantType;
import org.springframework.security.web.FilterChainProxy;
import org.springframework.security.web.SecurityFilterChain;
@ -96,11 +96,11 @@ public class OAuth2WebSecurityConfigurationTests {
List<Filter> filters = (List<Filter>) ReflectionTestUtils
.getField(filterChains.get(0), "filters");
List<Filter> oauth2Filters = filters.stream()
.filter((f) -> f instanceof AuthorizationCodeAuthenticationFilter
.filter((f) -> f instanceof OAuth2LoginAuthenticationFilter
|| f instanceof AuthorizationRequestRedirectFilter)
.collect(Collectors.toList());
return oauth2Filters.stream()
.filter((f) -> f instanceof AuthorizationCodeAuthenticationFilter)
.filter((f) -> f instanceof OAuth2LoginAuthenticationFilter)
.collect(Collectors.toList());
}

Loading…
Cancel
Save