mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-12 05:13:33 +00:00
Update to Latest HttpRequestValues Contract
Issue gh-16858
This commit is contained in:
parent
c06b1f4916
commit
9dea1c2eb5
@ -20,6 +20,7 @@ import java.lang.reflect.Method;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.security.oauth2.client.annotation.ClientRegistrationId;
|
||||
import org.springframework.security.oauth2.client.web.ClientAttributes;
|
||||
@ -37,7 +38,7 @@ public final class ClientRegistrationIdProcessor implements HttpRequestValues.Pr
|
||||
public static ClientRegistrationIdProcessor DEFAULT_INSTANCE = new ClientRegistrationIdProcessor();
|
||||
|
||||
@Override
|
||||
public void process(Method method, @Nullable Object[] arguments, HttpRequestValues.Builder builder) {
|
||||
public void process(Method method, MethodParameter[] parameters, @Nullable Object[] arguments, HttpRequestValues.Builder builder) {
|
||||
ClientRegistrationId registeredId = AnnotationUtils.findAnnotation(method, ClientRegistrationId.class);
|
||||
if (registeredId != null) {
|
||||
String registrationId = registeredId.registrationId();
|
||||
|
@ -45,7 +45,7 @@ class ClientRegistrationIdProcessorTests {
|
||||
void processWhenClientRegistrationIdPresentThenSet() {
|
||||
HttpRequestValues.Builder builder = HttpRequestValues.builder();
|
||||
Method hasClientRegistrationId = ReflectionUtils.findMethod(RestService.class, "hasClientRegistrationId");
|
||||
this.processor.process(hasClientRegistrationId, null, builder);
|
||||
this.processor.process(hasClientRegistrationId, null, null, builder);
|
||||
|
||||
String registrationId = ClientAttributes.resolveClientRegistrationId(builder.build().getAttributes());
|
||||
assertThat(registrationId).isEqualTo(RestService.REGISTRATION_ID);
|
||||
@ -55,7 +55,7 @@ class ClientRegistrationIdProcessorTests {
|
||||
void processWhenMetaClientRegistrationIdPresentThenSet() {
|
||||
HttpRequestValues.Builder builder = HttpRequestValues.builder();
|
||||
Method hasClientRegistrationId = ReflectionUtils.findMethod(RestService.class, "hasMetaClientRegistrationId");
|
||||
this.processor.process(hasClientRegistrationId, null, builder);
|
||||
this.processor.process(hasClientRegistrationId, null, null, builder);
|
||||
|
||||
String registrationId = ClientAttributes.resolveClientRegistrationId(builder.build().getAttributes());
|
||||
assertThat(registrationId).isEqualTo(RestService.REGISTRATION_ID);
|
||||
@ -65,7 +65,7 @@ class ClientRegistrationIdProcessorTests {
|
||||
void processWhenNoClientRegistrationIdPresentThenNull() {
|
||||
HttpRequestValues.Builder builder = HttpRequestValues.builder();
|
||||
Method hasClientRegistrationId = ReflectionUtils.findMethod(RestService.class, "noClientRegistrationId");
|
||||
this.processor.process(hasClientRegistrationId, null, builder);
|
||||
this.processor.process(hasClientRegistrationId, null, null, builder);
|
||||
|
||||
String registrationId = ClientAttributes.resolveClientRegistrationId(builder.build().getAttributes());
|
||||
assertThat(registrationId).isNull();
|
||||
|
Loading…
x
Reference in New Issue
Block a user