@@ -35,6 +35,7 @@ class AuthorizeRequestsDsl : AbstractRequestMatcherDsl() {
35
35
private val MVC_PRESENT = ClassUtils .isPresent(
36
36
HANDLER_MAPPING_INTROSPECTOR ,
37
37
AuthorizeRequestsDsl ::class .java.classLoader)
38
+ private val PATTERN_TYPE = if (MVC_PRESENT ) PatternType .MVC else PatternType .ANT
38
39
39
40
/* *
40
41
* Adds a request authorization rule.
@@ -64,11 +65,7 @@ class AuthorizeRequestsDsl : AbstractRequestMatcherDsl() {
64
65
* (i.e. "hasAuthority('ROLE_USER') and hasAuthority('ROLE_SUPER')")
65
66
*/
66
67
fun authorize (pattern : String , access : String = "authenticated") {
67
- if (MVC_PRESENT ) {
68
- authorizationRules.add(PatternAuthorizationRule (pattern, PatternType .MVC , null , access))
69
- } else {
70
- authorizationRules.add(PatternAuthorizationRule (pattern, PatternType .ANT , null , access))
71
- }
68
+ authorizationRules.add(PatternAuthorizationRule (pattern, PATTERN_TYPE , null , access))
72
69
}
73
70
74
71
/* *
@@ -89,11 +86,7 @@ class AuthorizeRequestsDsl : AbstractRequestMatcherDsl() {
89
86
* (i.e. "hasAuthority('ROLE_USER') and hasAuthority('ROLE_SUPER')")
90
87
*/
91
88
fun authorize (pattern : String , servletPath : String , access : String = "authenticated") {
92
- if (MVC_PRESENT ) {
93
- authorizationRules.add(PatternAuthorizationRule (pattern, PatternType .MVC , servletPath, access))
94
- } else {
95
- authorizationRules.add(PatternAuthorizationRule (pattern, PatternType .ANT , servletPath, access))
96
- }
89
+ authorizationRules.add(PatternAuthorizationRule (pattern, PATTERN_TYPE , servletPath, access))
97
90
}
98
91
99
92
/* *
0 commit comments