In my spring security configuration I have
<http auto-config="true" use-expressions="true" path-type="regex">
...
<intercept-url pattern="/admin/*" access="hasRole('ROLE_ADMIN')" />
This pattern matches the path "/admin" as well, even if this string is not produced by the regex "/admin/*" (there is no slash at the end). Why is that? I found no documentation about it. Does regex path matching have any other peculiarity like this one? I am using Spring Security 3.0.
EDIT I obviously was mistaking " " for ". ". Should have taken a nap instead of asking it here :)
*
in a regex means "match the preceding character zero or more times", so your regex does match the string "/admin".
You probably want to use +
which means "match the preceding character one or more times".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.