Update Removed Usages

Issue gh-13544
This commit is contained in:
Josh Cummings 2023-07-14 17:54:52 -06:00
parent a99dff7de3
commit 6c3636d780
No known key found for this signature in database
GPG Key ID: A306A51F43B8E5A5
14 changed files with 20 additions and 22 deletions

View File

@ -66,7 +66,7 @@ public class SecurityConfig {
@Bean
public AuthenticationProvider authenticationProvider() {
Assert.notNull(this.myUserRepository);
Assert.notNull(this.myUserRepository, "myUserRepository cannot be null");
return new AuthenticationProvider() {
@Override
public boolean supports(Class<?> authentication) {

View File

@ -24,8 +24,8 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.StandardReflectionParameterNameDiscoverer;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
@ -60,11 +60,11 @@ public class DefaultSecurityParameterNameDiscovererTests {
@Test
public void constructorDiscoverers() {
this.discoverer = new DefaultSecurityParameterNameDiscoverer(
Arrays.asList(new LocalVariableTableParameterNameDiscoverer()));
Arrays.asList(new StandardReflectionParameterNameDiscoverer()));
List<ParameterNameDiscoverer> discoverers = (List<ParameterNameDiscoverer>) ReflectionTestUtils
.getField(this.discoverer, "parameterNameDiscoverers");
assertThat(discoverers).hasSize(3);
assertThat(discoverers.get(0)).isInstanceOf(LocalVariableTableParameterNameDiscoverer.class);
assertThat(discoverers.get(0)).isInstanceOf(StandardReflectionParameterNameDiscoverer.class);
ParameterNameDiscoverer annotationDisc = discoverers.get(1);
assertThat(annotationDisc).isInstanceOf(AnnotationParameterNameDiscoverer.class);
Set<String> annotationsToUse = (Set<String>) ReflectionTestUtils.getField(annotationDisc,

View File

@ -26,8 +26,8 @@ import org.python.core.Py;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.StandardReflectionParameterNameDiscoverer;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.security.access.prepost.PreInvocationAttribute;
@ -37,7 +37,7 @@ import org.springframework.util.ClassUtils;
public class PythonInterpreterPreInvocationAdvice implements PreInvocationAuthorizationAdvice {
private final ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
private final ParameterNameDiscoverer parameterNameDiscoverer = new StandardReflectionParameterNameDiscoverer();
@Override
public boolean before(Authentication authentication, MethodInvocation mi, PreInvocationAttribute preAttr) {

View File

@ -40,7 +40,7 @@ import org.springframework.cglib.proxy.Callback;
import org.springframework.cglib.proxy.Enhancer;
import org.springframework.cglib.proxy.Factory;
import org.springframework.cglib.proxy.MethodProxy;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.MethodIntrospector;
import org.springframework.core.MethodParameter;
import org.springframework.core.ParameterNameDiscoverer;
@ -132,7 +132,7 @@ public final class ResolvableMethod {
private static final SpringObjenesis objenesis = new SpringObjenesis();
private static final ParameterNameDiscoverer nameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
private static final ParameterNameDiscoverer nameDiscoverer = new DefaultParameterNameDiscoverer();
// Matches ValueConstants.DEFAULT_NONE (spring-web and spring-messaging)
private static final String DEFAULT_VALUE_NONE = "\n\t\t\n\t\t\n\uE000\uE001\uE002\n\t\t\t\t\n";

View File

@ -523,7 +523,7 @@ public final class ServerOAuth2AuthorizedClientExchangeFilterFunction implements
authParameters.get(OAuth2ParameterNames.ERROR_URI));
}
}
return resolveErrorIfPossible(response.rawStatusCode());
return resolveErrorIfPossible(response.statusCode().value());
}
private OAuth2Error resolveErrorIfPossible(int statusCode) {

View File

@ -639,7 +639,7 @@ public final class ServletOAuth2AuthorizedClientExchangeFilterFunction implement
authParameters.get(OAuth2ParameterNames.ERROR_URI));
}
}
return resolveErrorIfPossible(response.rawStatusCode());
return resolveErrorIfPossible(response.statusCode().value());
}
private OAuth2Error resolveErrorIfPossible(int statusCode) {

View File

@ -485,7 +485,7 @@ public class ServerOAuth2AuthorizedClientExchangeFilterFunctionTests {
.attributes(ServerOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient(authorizedClient))
.build();
// @formatter:on
given(this.exchange.getResponse().rawStatusCode()).willReturn(HttpStatus.UNAUTHORIZED.value());
given(this.exchange.getResponse().statusCode()).willReturn(HttpStatus.UNAUTHORIZED);
this.function.filter(request, this.exchange).contextWrite(serverWebExchange()).block();
assertThat(publisherProbe.wasSubscribed()).isTrue();
verify(this.authorizationFailureHandler).onAuthorizationFailure(this.authorizationExceptionCaptor.capture(),
@ -560,7 +560,7 @@ public class ServerOAuth2AuthorizedClientExchangeFilterFunctionTests {
.attributes(ServerOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient(authorizedClient))
.build();
// @formatter:on
given(this.exchange.getResponse().rawStatusCode()).willReturn(HttpStatus.FORBIDDEN.value());
given(this.exchange.getResponse().statusCode()).willReturn(HttpStatus.FORBIDDEN);
this.function.filter(request, this.exchange).contextWrite(serverWebExchange()).block();
assertThat(publisherProbe.wasSubscribed()).isTrue();
verify(this.authorizationFailureHandler).onAuthorizationFailure(this.authorizationExceptionCaptor.capture(),
@ -691,7 +691,7 @@ public class ServerOAuth2AuthorizedClientExchangeFilterFunctionTests {
ClientRequest request = ClientRequest.create(HttpMethod.GET, URI.create("https://example.com"))
.attributes(ServerOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient(authorizedClient))
.build();
given(this.exchange.getResponse().rawStatusCode()).willReturn(HttpStatus.BAD_REQUEST.value());
given(this.exchange.getResponse().statusCode()).willReturn(HttpStatus.BAD_REQUEST);
this.function.filter(request, this.exchange).contextWrite(serverWebExchange()).block();
verify(this.authorizationFailureHandler, never()).onAuthorizationFailure(any(), any(), any());
}

View File

@ -676,7 +676,7 @@ public class ServletOAuth2AuthorizedClientExchangeFilterFunctionTests {
.attributes(ServletOAuth2AuthorizedClientExchangeFilterFunction.httpServletRequest(servletRequest))
.attributes(ServletOAuth2AuthorizedClientExchangeFilterFunction.httpServletResponse(servletResponse))
.build();
given(this.exchange.getResponse().rawStatusCode()).willReturn(httpStatus.value());
given(this.exchange.getResponse().statusCode()).willReturn(httpStatus);
given(this.exchange.getResponse().headers()).willReturn(mock(ClientResponse.Headers.class));
this.function.setAuthorizationFailureHandler(this.authorizationFailureHandler);
this.function.filter(request, this.exchange).block();
@ -825,7 +825,7 @@ public class ServletOAuth2AuthorizedClientExchangeFilterFunctionTests {
.attributes(ServletOAuth2AuthorizedClientExchangeFilterFunction.httpServletRequest(servletRequest))
.attributes(ServletOAuth2AuthorizedClientExchangeFilterFunction.httpServletResponse(servletResponse))
.build();
given(this.exchange.getResponse().rawStatusCode()).willReturn(HttpStatus.BAD_REQUEST.value());
given(this.exchange.getResponse().statusCode()).willReturn(HttpStatus.BAD_REQUEST);
given(this.exchange.getResponse().headers()).willReturn(mock(ClientResponse.Headers.class));
this.function.setAuthorizationFailureHandler(this.authorizationFailureHandler);
this.function.filter(request, this.exchange).block();

View File

@ -133,7 +133,7 @@ public class NimbusReactiveOpaqueTokenIntrospector implements ReactiveOpaqueToke
+ contentType + "' is not compatible with JSON");
}
HTTPResponse response = new HTTPResponse(responseEntity.rawStatusCode());
HTTPResponse response = new HTTPResponse(responseEntity.statusCode().value());
response.setHeader(HttpHeaders.CONTENT_TYPE, contentType.toString());
if (response.getStatusCode() != HTTPResponse.SC_OK) {
this.logger.trace("Introspection endpoint returned non-OK status code");

View File

@ -270,7 +270,6 @@ public class NimbusReactiveOpaqueTokenIntrospectorTests {
WebClient webClient = spy(WebClient.class);
given(webClient.post()).willReturn(spec);
ClientResponse clientResponse = mock(ClientResponse.class);
given(clientResponse.rawStatusCode()).willReturn(200);
given(clientResponse.statusCode()).willReturn(HttpStatus.OK);
given(clientResponse.bodyToMono(String.class)).willReturn(Mono.just(response));
ClientResponse.Headers headers = mock(ClientResponse.Headers.class);

View File

@ -227,7 +227,6 @@ public class SpringReactiveOpaqueTokenIntrospectorTests {
WebClient webClient = spy(WebClient.class);
given(webClient.post()).willReturn(spec);
ClientResponse clientResponse = mock(ClientResponse.class);
given(clientResponse.rawStatusCode()).willReturn(200);
given(clientResponse.statusCode()).willReturn(HttpStatus.OK);
given(clientResponse.bodyToMono(STRING_OBJECT_MAP)).willReturn(Mono.just(response));
ClientResponse.Headers headers = mock(ClientResponse.Headers.class);

View File

@ -66,7 +66,7 @@ public class DispatcherTypeRequestMatcher implements RequestMatcher {
@Override
public boolean matches(HttpServletRequest request) {
if (this.httpMethod != null && StringUtils.hasText(request.getMethod())
&& this.httpMethod != HttpMethod.resolve(request.getMethod())) {
&& this.httpMethod != HttpMethod.valueOf(request.getMethod())) {
return false;
}
return this.dispatcherType == request.getDispatcherType();

View File

@ -116,7 +116,7 @@ public final class RegexRequestMatcher implements RequestMatcher {
@Override
public boolean matches(HttpServletRequest request) {
if (this.httpMethod != null && request.getMethod() != null
&& this.httpMethod != HttpMethod.resolve(request.getMethod())) {
&& this.httpMethod != HttpMethod.valueOf(request.getMethod())) {
return false;
}
String url = request.getServletPath();

View File

@ -40,7 +40,7 @@ import org.springframework.cglib.proxy.Callback;
import org.springframework.cglib.proxy.Enhancer;
import org.springframework.cglib.proxy.Factory;
import org.springframework.cglib.proxy.MethodProxy;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.MethodIntrospector;
import org.springframework.core.MethodParameter;
import org.springframework.core.ParameterNameDiscoverer;
@ -131,7 +131,7 @@ public final class ResolvableMethod {
private static final SpringObjenesis objenesis = new SpringObjenesis();
private static final ParameterNameDiscoverer nameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
private static final ParameterNameDiscoverer nameDiscoverer = new DefaultParameterNameDiscoverer();
private final Method method;