Skip to content

Commit 2fdf762

Browse files
Merge branch '5.8.x' into 6.0.x
2 parents f487f85 + 7aaa25b commit 2fdf762

File tree

3 files changed

+44
-18
lines changed

3 files changed

+44
-18
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/configurers/DefaultLoginPageConfigurer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
*
5151
* <h2>Shared Objects Created</h2>
5252
*
53-
* No shared objects are created. isLogoutRequest
53+
* No shared objects are created.
54+
*
5455
* <h2>Shared Objects Used</h2>
5556
*
5657
* The following shared objects are used:

config/src/main/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationConfigurer.java

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@
4848
* </p>
4949
*
5050
* <pre>
51-
* protected void configure(HttpSecurity http) throws Exception {
52-
* http.apply(new UrlAuthorizationConfigurer&lt;HttpSecurity&gt;()).getRegistry()
51+
* &#64;Bean
52+
* public SecurityFilterChain filterChain(HttpSecurity http, ApplicationContext context) throws Exception {
53+
* http.apply(new UrlAuthorizationConfigurer&lt;HttpSecurity&gt;(context)).getRegistry()
5354
* .requestMatchers(&quot;/users**&quot;, &quot;/sessions/**&quot;).hasRole(&quot;USER&quot;)
5455
* .requestMatchers(&quot;/signup&quot;).hasRole(&quot;ANONYMOUS&quot;).anyRequest().hasRole(&quot;USER&quot;);
5556
* }
@@ -201,24 +202,22 @@ private StandardInterceptUrlRegistry(ApplicationContext context) {
201202
setApplicationContext(context);
202203
}
203204

205+
/**
206+
* @deprecated use {@link #requestMatchers(HttpMethod, String...)} instead
207+
*/
204208
@Override
205-
public AuthorizedUrl requestMatchers(String... patterns) {
206-
return super.requestMatchers(patterns);
207-
}
208-
209-
@Override
210-
public AuthorizedUrl requestMatchers(HttpMethod method, String... patterns) {
211-
return super.requestMatchers(method, patterns);
212-
}
213-
214-
@Override
215-
public AuthorizedUrl requestMatchers(HttpMethod method) {
216-
return super.requestMatchers(method);
209+
@Deprecated
210+
public MvcMatchersAuthorizedUrl mvcMatchers(HttpMethod method, String... mvcPatterns) {
211+
return new MvcMatchersAuthorizedUrl(createMvcMatchers(method, mvcPatterns));
217212
}
218213

214+
/**
215+
* @deprecated use {@link #requestMatchers(String...)} instead
216+
*/
219217
@Override
220-
public AuthorizedUrl requestMatchers(RequestMatcher... requestMatchers) {
221-
return super.requestMatchers(requestMatchers);
218+
@Deprecated
219+
public MvcMatchersAuthorizedUrl mvcMatchers(String... patterns) {
220+
return mvcMatchers(null, patterns);
222221
}
223222

224223
@Override
@@ -243,6 +242,32 @@ public H and() {
243242

244243
}
245244

245+
/**
246+
* An {@link AuthorizedUrl} that allows optionally configuring the
247+
* {@link MvcRequestMatcher#setMethod(HttpMethod)}
248+
*
249+
* @author Rob Winch
250+
*/
251+
public final class MvcMatchersAuthorizedUrl extends AuthorizedUrl {
252+
253+
/**
254+
* Creates a new instance
255+
* @param requestMatchers the {@link RequestMatcher} instances to map
256+
*/
257+
private MvcMatchersAuthorizedUrl(List<MvcRequestMatcher> requestMatchers) {
258+
super(requestMatchers);
259+
}
260+
261+
@SuppressWarnings("unchecked")
262+
public AuthorizedUrl servletPath(String servletPath) {
263+
for (MvcRequestMatcher matcher : (List<MvcRequestMatcher>) getMatchers()) {
264+
matcher.setServletPath(servletPath);
265+
}
266+
return this;
267+
}
268+
269+
}
270+
246271
/**
247272
* Maps the specified {@link RequestMatcher} instances to {@link ConfigAttribute}
248273
* instances.

docs/modules/ROOT/pages/servlet/oauth2/resource-server/multitenancy.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public class TenantJWSKeySelector
248248
}
249249
250250
private JWSKeySelector<SecurityContext> fromTenant(String tenant) {
251-
return Optional.ofNullable(this.tenantRepository.findById(tenant)) <3>
251+
return Optional.ofNullable(this.tenants.findById(tenant)) <3>
252252
.map(t -> t.getAttrbute("jwks_uri"))
253253
.map(this::fromUri)
254254
.orElseThrow(() -> new IllegalArgumentException("unknown tenant"));

0 commit comments

Comments
 (0)