spring-security icon indicating copy to clipboard operation
spring-security copied to clipboard

Kotlin DSL authorize cannot default access string when servletPath is set

Open eleftherias opened this issue 2 years ago • 0 comments

The Kotlin AuthorizeRequestsDsl has multiple signatures for the authorize method including the following two:

authorize(pattern: String, access: String = "authenticated")

and

authorize(pattern: String, servletPath: String, access: String = "authenticated")

Although the access string is defaulted in the second method, users cannot take advantage of the default value, because supplying 2 strings will always result in the first method being evaluated.

For example, authorize("/path", "x") is equivalent to authorize(pattern = "/path", access = "x") and not authorize(pattern = "/path", servletPath = "x").

eleftherias avatar Mar 11 '22 09:03 eleftherias