Skip to content

Commit 14f38e1

Browse files
committed
Merge branch '1.2.x' into 1.3.x
2 parents 41d3c30 + ab6f4e4 commit 14f38e1

File tree

2 files changed

+4
-41
lines changed

2 files changed

+4
-41
lines changed

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/config/annotation/web/configurers/OAuth2AuthorizationEndpointConfigurer.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2024 the original author or authors.
2+
* Copyright 2020-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -241,13 +241,9 @@ void init(HttpSecurity httpSecurity) {
241241
? OAuth2ConfigurerUtils
242242
.withMultipleIssuersPattern(authorizationServerSettings.getAuthorizationEndpoint())
243243
: authorizationServerSettings.getAuthorizationEndpoint();
244-
List<RequestMatcher> requestMatchers = new ArrayList<>();
245-
requestMatchers.add(new AntPathRequestMatcher(authorizationEndpointUri, HttpMethod.GET.name()));
246-
requestMatchers.add(new AntPathRequestMatcher(authorizationEndpointUri, HttpMethod.POST.name()));
247-
if (StringUtils.hasText(this.consentPage)) {
248-
requestMatchers.add(new AntPathRequestMatcher(this.consentPage));
249-
}
250-
this.requestMatcher = new OrRequestMatcher(requestMatchers);
244+
this.requestMatcher = new OrRequestMatcher(
245+
new AntPathRequestMatcher(authorizationEndpointUri, HttpMethod.GET.name()),
246+
new AntPathRequestMatcher(authorizationEndpointUri, HttpMethod.POST.name()));
251247
List<AuthenticationProvider> authenticationProviders = createDefaultAuthenticationProviders(httpSecurity);
252248
if (!this.authenticationProviders.isEmpty()) {
253249
authenticationProviders.addAll(0, this.authenticationProviders);

oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/config/annotation/web/configurers/OAuth2AuthorizationCodeGrantTests.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@
104104
import org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository;
105105
import org.springframework.security.oauth2.server.authorization.client.TestRegisteredClients;
106106
import org.springframework.security.oauth2.server.authorization.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration;
107-
import org.springframework.security.oauth2.server.authorization.context.AuthorizationServerContextHolder;
108107
import org.springframework.security.oauth2.server.authorization.jackson2.TestingAuthenticationTokenMixin;
109108
import org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings;
110109
import org.springframework.security.oauth2.server.authorization.settings.ClientSettings;
@@ -126,14 +125,11 @@
126125
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
127126
import org.springframework.security.web.context.SecurityContextRepository;
128127
import org.springframework.security.web.util.matcher.RequestMatcher;
129-
import org.springframework.stereotype.Controller;
130128
import org.springframework.test.web.servlet.MockMvc;
131129
import org.springframework.test.web.servlet.MvcResult;
132130
import org.springframework.util.LinkedMultiValueMap;
133131
import org.springframework.util.MultiValueMap;
134132
import org.springframework.util.StringUtils;
135-
import org.springframework.web.bind.annotation.GetMapping;
136-
import org.springframework.web.bind.annotation.ResponseBody;
137133
import org.springframework.web.util.UriComponents;
138134
import org.springframework.web.util.UriComponentsBuilder;
139135
import org.springframework.web.util.UriUtils;
@@ -750,15 +746,6 @@ public void requestWhenCustomConsentPageConfiguredThenRedirect() throws Exceptio
750746
assertThat(authorization).isNotNull();
751747
}
752748

753-
// gh-1668
754-
@Test
755-
public void requestWhenCustomConsentPageConfiguredThenAuthorizationServerContextIsAccessible() throws Exception {
756-
this.spring.register(AuthorizationServerConfigurationCustomConsentPageAccessAuthorizationServerContext.class)
757-
.autowire();
758-
759-
this.mvc.perform(get(consentPage).with(user("user"))).andExpect(status().isOk());
760-
}
761-
762749
@Test
763750
public void requestWhenCustomConsentCustomizerConfiguredThenUsed() throws Exception {
764751
this.spring.register(AuthorizationServerConfigurationCustomConsentRequest.class).autowire();
@@ -1222,26 +1209,6 @@ SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http) th
12221209

12231210
}
12241211

1225-
@EnableWebSecurity
1226-
@Configuration(proxyBeanMethods = false)
1227-
static class AuthorizationServerConfigurationCustomConsentPageAccessAuthorizationServerContext
1228-
extends AuthorizationServerConfigurationCustomConsentPage {
1229-
1230-
@Controller
1231-
class ConsentController {
1232-
1233-
@GetMapping("/oauth2/consent")
1234-
@ResponseBody
1235-
String consent() {
1236-
// Ensure the AuthorizationServerContext is accessible
1237-
AuthorizationServerContextHolder.getContext().getIssuer();
1238-
return "";
1239-
}
1240-
1241-
}
1242-
1243-
}
1244-
12451212
@EnableWebSecurity
12461213
@Configuration(proxyBeanMethods = false)
12471214
static class AuthorizationServerConfigurationCustomConsentRequest extends AuthorizationServerConfiguration {

0 commit comments

Comments
 (0)