Skip to content

Commit 989aee2

Browse files
committed
Deprecate SecurityMetadataSource
Closes gh-16772
1 parent 44d5539 commit 989aee2

File tree

5 files changed

+42
-1
lines changed

5 files changed

+42
-1
lines changed

core/src/main/java/org/springframework/security/access/SecurityMetadataSource.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@
2020

2121
import org.springframework.aop.framework.AopInfrastructureBean;
2222
import org.springframework.security.access.intercept.AbstractSecurityInterceptor;
23+
import org.springframework.security.authorization.AuthorizationManager;
24+
import org.springframework.security.core.annotation.SecurityAnnotationScanner;
2325

2426
/**
2527
* Implemented by classes that store and can identify the {@link ConfigAttribute}s that
2628
* applies to a given secure object invocation.
2729
*
2830
* @author Ben Alex
31+
* @deprecated In modern Spring Security APIs, each API manages its own configuration
32+
* context. As such there is no direct replacement for this interface. In the case of
33+
* method security, please see {@link SecurityAnnotationScanner} and
34+
* {@link AuthorizationManager}. In the case of channel security, please see
35+
* {@code HttpsRedirectFilter}. In the case of web security, please see
36+
* {@link AuthorizationManager}.
2937
*/
38+
@Deprecated
3039
public interface SecurityMetadataSource extends AopInfrastructureBean {
3140

3241
/**

web/src/main/java/org/springframework/security/web/access/expression/ExpressionBasedFilterInvocationSecurityMetadataSource.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import org.springframework.expression.ParseException;
3232
import org.springframework.security.access.ConfigAttribute;
3333
import org.springframework.security.access.expression.SecurityExpressionHandler;
34+
import org.springframework.security.authorization.AuthorizationManager;
35+
import org.springframework.security.core.annotation.SecurityAnnotationScanner;
3436
import org.springframework.security.web.FilterInvocation;
3537
import org.springframework.security.web.access.intercept.DefaultFilterInvocationSecurityMetadataSource;
3638
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@@ -43,7 +45,14 @@
4345
* @author Luke Taylor
4446
* @author Eddú Meléndez
4547
* @since 3.0
48+
* @deprecated In modern Spring Security APIs, each API manages its own configuration
49+
* context. As such there is no direct replacement for this interface. In the case of
50+
* method security, please see {@link SecurityAnnotationScanner} and
51+
* {@link AuthorizationManager}. In the case of channel security, please see
52+
* {@code HttpsRedirectFilter}. In the case of web security, please see
53+
* {@link AuthorizationManager}.
4654
*/
55+
@Deprecated
4756
public final class ExpressionBasedFilterInvocationSecurityMetadataSource
4857
extends DefaultFilterInvocationSecurityMetadataSource {
4958

web/src/main/java/org/springframework/security/web/access/intercept/DefaultFilterInvocationSecurityMetadataSource.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929
import org.springframework.core.log.LogMessage;
3030
import org.springframework.security.access.ConfigAttribute;
31+
import org.springframework.security.authorization.AuthorizationManager;
32+
import org.springframework.security.core.annotation.SecurityAnnotationScanner;
3133
import org.springframework.security.web.FilterInvocation;
3234
import org.springframework.security.web.util.matcher.RequestMatcher;
3335

@@ -50,7 +52,14 @@
5052
*
5153
* @author Ben Alex
5254
* @author Luke Taylor
55+
* @deprecated In modern Spring Security APIs, each API manages its own configuration
56+
* context. As such there is no direct replacement for this interface. In the case of
57+
* method security, please see {@link SecurityAnnotationScanner} and
58+
* {@link AuthorizationManager}. In the case of channel security, please see
59+
* {@code HttpsRedirectFilter}. In the case of web security, please see
60+
* {@link AuthorizationManager}.
5361
*/
62+
@Deprecated
5463
public class DefaultFilterInvocationSecurityMetadataSource implements FilterInvocationSecurityMetadataSource {
5564

5665
protected final Log logger = LogFactory.getLog(getClass());

web/src/main/java/org/springframework/security/web/access/intercept/FilterInvocationSecurityMetadataSource.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,23 @@
1717
package org.springframework.security.web.access.intercept;
1818

1919
import org.springframework.security.access.SecurityMetadataSource;
20+
import org.springframework.security.authorization.AuthorizationManager;
21+
import org.springframework.security.core.annotation.SecurityAnnotationScanner;
2022
import org.springframework.security.web.FilterInvocation;
2123

2224
/**
2325
* Marker interface for <code>SecurityMetadataSource</code> implementations that are
2426
* designed to perform lookups keyed on {@link FilterInvocation}s.
2527
*
2628
* @author Ben Alex
29+
* @deprecated In modern Spring Security APIs, each API manages its own configuration
30+
* context. As such there is no direct replacement for this interface. In the case of
31+
* method security, please see {@link SecurityAnnotationScanner} and
32+
* {@link AuthorizationManager}. In the case of channel security, please see
33+
* {@code HttpsRedirectFilter}. In the case of web security, please see
34+
* {@link AuthorizationManager}.
2735
*/
36+
@Deprecated
2837
public interface FilterInvocationSecurityMetadataSource extends SecurityMetadataSource {
2938

3039
}

web/src/main/java/org/springframework/security/web/servlet/util/matcher/PathPatternRequestMatcher.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ void setServletPath(RequestMatcher servletPath) {
127127
}
128128

129129
private RequestPath getRequestPath(HttpServletRequest request) {
130-
return ServletRequestPathUtils.getParsedRequestPath(request);
130+
if (ServletRequestPathUtils.hasParsedRequestPath(request)) {
131+
return ServletRequestPathUtils.getParsedRequestPath(request);
132+
}
133+
else {
134+
return ServletRequestPathUtils.parseAndCache(request);
135+
}
131136
}
132137

133138
/**

0 commit comments

Comments
 (0)