Remove deprecated API usage
This commit is contained in:
@@ -38,7 +38,7 @@ import org.springframework.security.oauth2.server.authorization.web.OAuth2Author
|
||||
import org.springframework.security.oauth2.server.authorization.web.ProviderContextFilter;
|
||||
import org.springframework.security.web.authentication.HttpStatusEntryPoint;
|
||||
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
|
||||
import org.springframework.security.web.context.SecurityContextPersistenceFilter;
|
||||
import org.springframework.security.web.context.SecurityContextHolderFilter;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
import org.springframework.security.web.util.matcher.OrRequestMatcher;
|
||||
import org.springframework.security.web.util.matcher.RequestMatcher;
|
||||
@@ -246,7 +246,7 @@ public final class OAuth2AuthorizationServerConfigurer
|
||||
ProviderSettings providerSettings = OAuth2ConfigurerUtils.getProviderSettings(httpSecurity);
|
||||
|
||||
ProviderContextFilter providerContextFilter = new ProviderContextFilter(providerSettings);
|
||||
httpSecurity.addFilterAfter(postProcess(providerContextFilter), SecurityContextPersistenceFilter.class);
|
||||
httpSecurity.addFilterAfter(postProcess(providerContextFilter), SecurityContextHolderFilter.class);
|
||||
|
||||
JWKSource<com.nimbusds.jose.proc.SecurityContext> jwkSource = OAuth2ConfigurerUtils.getJwkSource(httpSecurity);
|
||||
if (jwkSource != null) {
|
||||
|
||||
@@ -562,7 +562,7 @@ public class OAuth2AuthorizationServerMetadataTests {
|
||||
.claim("claim-name", "claim-value")
|
||||
.claims((claims) -> claims.remove("claim-name"))
|
||||
.build();
|
||||
assertThat(authorizationServerMetadata.containsClaim("claim-name")).isFalse();
|
||||
assertThat(authorizationServerMetadata.hasClaim("claim-name")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -571,7 +571,7 @@ public class OAuth2AuthorizationServerMetadataTests {
|
||||
this.minimalBuilder
|
||||
.claim("claim-name", "claim-value")
|
||||
.build();
|
||||
assertThat(authorizationServerMetadata.containsClaim("claim-name")).isTrue();
|
||||
assertThat(authorizationServerMetadata.hasClaim("claim-name")).isTrue();
|
||||
}
|
||||
|
||||
private static URL url(String urlString) {
|
||||
|
||||
@@ -75,7 +75,6 @@ import org.springframework.test.web.servlet.ResultMatcher;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.springframework.test.web.servlet.ResultMatcher.matchAll;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
@@ -124,7 +123,7 @@ public class OidcUserInfoTests {
|
||||
this.mvc.perform(get(DEFAULT_OIDC_USER_INFO_ENDPOINT_URI)
|
||||
.header(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken.getTokenValue()))
|
||||
.andExpect(status().is2xxSuccessful())
|
||||
.andExpect(userInfoResponse());
|
||||
.andExpectAll(userInfoResponse());
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
@@ -140,7 +139,7 @@ public class OidcUserInfoTests {
|
||||
this.mvc.perform(post(DEFAULT_OIDC_USER_INFO_ENDPOINT_URI)
|
||||
.header(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken.getTokenValue()))
|
||||
.andExpect(status().is2xxSuccessful())
|
||||
.andExpect(userInfoResponse());
|
||||
.andExpectAll(userInfoResponse());
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
@@ -156,7 +155,7 @@ public class OidcUserInfoTests {
|
||||
this.mvc.perform(get(DEFAULT_OIDC_USER_INFO_ENDPOINT_URI)
|
||||
.header(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken.getTokenValue()))
|
||||
.andExpect(status().is2xxSuccessful())
|
||||
.andExpect(userInfoResponse());
|
||||
.andExpectAll(userInfoResponse());
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
@@ -173,7 +172,7 @@ public class OidcUserInfoTests {
|
||||
MvcResult mvcResult = this.mvc.perform(get(DEFAULT_OIDC_USER_INFO_ENDPOINT_URI)
|
||||
.header(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken.getTokenValue()))
|
||||
.andExpect(status().is2xxSuccessful())
|
||||
.andExpect(userInfoResponse())
|
||||
.andExpectAll(userInfoResponse())
|
||||
.andReturn();
|
||||
// @formatter:on
|
||||
|
||||
@@ -182,9 +181,9 @@ public class OidcUserInfoTests {
|
||||
assertThat(securityContext.getAuthentication()).isNull();
|
||||
}
|
||||
|
||||
private static ResultMatcher userInfoResponse() {
|
||||
private static ResultMatcher[] userInfoResponse() {
|
||||
// @formatter:off
|
||||
return matchAll(
|
||||
return new ResultMatcher[] {
|
||||
jsonPath("sub").value("user1"),
|
||||
jsonPath("name").value("First Last"),
|
||||
jsonPath("given_name").value("First"),
|
||||
@@ -205,7 +204,7 @@ public class OidcUserInfoTests {
|
||||
jsonPath("phone_number_verified").value("false"),
|
||||
jsonPath("address.formatted").value("Champ de Mars\n5 Av. Anatole France\n75007 Paris\nFrance"),
|
||||
jsonPath("updated_at").value("1970-01-01T00:00:00Z")
|
||||
);
|
||||
};
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
|
||||
@@ -399,7 +399,7 @@ public class OidcClientRegistrationTests {
|
||||
.build();
|
||||
// @formatter:on
|
||||
|
||||
assertThat(clientRegistration.containsClaim("claim-name")).isFalse();
|
||||
assertThat(clientRegistration.hasClaim("claim-name")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -410,7 +410,7 @@ public class OidcClientRegistrationTests {
|
||||
.build();
|
||||
// @formatter:on
|
||||
|
||||
assertThat(clientRegistration.containsClaim("claim-name")).isTrue();
|
||||
assertThat(clientRegistration.hasClaim("claim-name")).isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ public class OidcProviderConfigurationTests {
|
||||
this.minimalConfigurationBuilder
|
||||
.claim("claim-name", "claim-value")
|
||||
.build();
|
||||
assertThat(configuration.containsClaim("claim-name")).isTrue();
|
||||
assertThat(configuration.hasClaim("claim-name")).isTrue();
|
||||
}
|
||||
|
||||
private static URL url(String urlString) {
|
||||
|
||||
Reference in New Issue
Block a user