diff --git a/config/src/main/kotlin/org/springframework/security/config/web/servlet/AbstractRequestMatcherDsl.kt b/config/src/main/kotlin/org/springframework/security/config/web/servlet/AbstractRequestMatcherDsl.kt index 3fcf38fa38..901f9862e4 100644 --- a/config/src/main/kotlin/org/springframework/security/config/web/servlet/AbstractRequestMatcherDsl.kt +++ b/config/src/main/kotlin/org/springframework/security/config/web/servlet/AbstractRequestMatcherDsl.kt @@ -37,7 +37,7 @@ abstract class AbstractRequestMatcherDsl { protected data class PatternAuthorizationRule(val pattern: String, val patternType: PatternType, - val servletPath: String?, + val servletPath: String? = null, override val rule: String) : AuthorizationRule(rule) protected abstract class AuthorizationRule(open val rule: String) diff --git a/config/src/main/kotlin/org/springframework/security/config/web/servlet/AuthorizeRequestsDsl.kt b/config/src/main/kotlin/org/springframework/security/config/web/servlet/AuthorizeRequestsDsl.kt index 53a0a0136c..3fa8b30501 100644 --- a/config/src/main/kotlin/org/springframework/security/config/web/servlet/AuthorizeRequestsDsl.kt +++ b/config/src/main/kotlin/org/springframework/security/config/web/servlet/AuthorizeRequestsDsl.kt @@ -65,7 +65,9 @@ class AuthorizeRequestsDsl : AbstractRequestMatcherDsl() { * (i.e. "hasAuthority('ROLE_USER') and hasAuthority('ROLE_SUPER')") */ fun authorize(pattern: String, access: String = "authenticated") { - authorizationRules.add(PatternAuthorizationRule(pattern, PATTERN_TYPE, null, access)) + authorizationRules.add(PatternAuthorizationRule(pattern = pattern, + patternType = PATTERN_TYPE, + rule = access)) } /** @@ -86,7 +88,10 @@ class AuthorizeRequestsDsl : AbstractRequestMatcherDsl() { * (i.e. "hasAuthority('ROLE_USER') and hasAuthority('ROLE_SUPER')") */ fun authorize(pattern: String, servletPath: String, access: String = "authenticated") { - authorizationRules.add(PatternAuthorizationRule(pattern, PATTERN_TYPE, servletPath, access)) + authorizationRules.add(PatternAuthorizationRule(pattern = pattern, + patternType = PATTERN_TYPE, + servletPath = servletPath, + rule = access)) } /** diff --git a/config/src/main/kotlin/org/springframework/security/config/web/servlet/RequiresChannelDsl.kt b/config/src/main/kotlin/org/springframework/security/config/web/servlet/RequiresChannelDsl.kt index e9fae414d0..a7149014c2 100644 --- a/config/src/main/kotlin/org/springframework/security/config/web/servlet/RequiresChannelDsl.kt +++ b/config/src/main/kotlin/org/springframework/security/config/web/servlet/RequiresChannelDsl.kt @@ -72,7 +72,9 @@ class RequiresChannelDsl : AbstractRequestMatcherDsl() { * (i.e. "REQUIRES_SECURE_CHANNEL") */ fun secure(pattern: String, attribute: String = "REQUIRES_SECURE_CHANNEL") { - channelSecurityRules.add(PatternAuthorizationRule(pattern, PATTERN_TYPE, null, attribute)) + channelSecurityRules.add(PatternAuthorizationRule(pattern = pattern, + patternType = PATTERN_TYPE, + rule = attribute)) } /** @@ -93,7 +95,10 @@ class RequiresChannelDsl : AbstractRequestMatcherDsl() { * (i.e. "REQUIRES_SECURE_CHANNEL") */ fun secure(pattern: String, servletPath: String, attribute: String = "REQUIRES_SECURE_CHANNEL") { - channelSecurityRules.add(PatternAuthorizationRule(pattern, PATTERN_TYPE, servletPath, attribute)) + channelSecurityRules.add(PatternAuthorizationRule(pattern = pattern, + patternType = PATTERN_TYPE, + servletPath = servletPath, + rule = attribute)) } /**