java - spring security filter chain patterns -
when using spring security map chain of filters url patters specify how urls secured. these patterns can contain wildcards such as
/foo/*/bar /foo/**/bar
i couldn't find docs these wildcards, guess first pattern match
/foo/baz/bar
but not
/foo/baz/baz/bar
whereas second pattern (/foo/**/bar
) match both of these
maybe code help:
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:security="http://www.springframework.org/schema/security" xmlns:p="http://www.springframework.org/schema/p" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <security:http auto-config="true"> <security:intercept-url pattern="/login.do" access="is_authenticated_anonymously" /> <security:intercept-url pattern="/logout.do" access="is_authenticated_anonymously" /> <security:intercept-url pattern="/fail2login.do" access="is_authenticated_anonymously" /> <security:intercept-url pattern="/json/*.do" access="is_authenticated_anonymously" /> <security:intercept-url pattern="/*" access="role_admin" /> <security:form-login login-page="/login.do" default-target-url="/home.do" authentication-failure-url="/fail2login.do" /> <security:session-management> <security:concurrency-control max-sessions="1" /> </security:session-management> <security:logout logout-success-url="/logout.do" delete-cookies="jsessionid" invalidate-session="true" /> </security:http> <security:authentication-manager> <security:authentication-provider> <security:jdbc-user-service data-source-ref="datasource" users-by-username-query="select username, password, status user username=?" authorities-by-username-query="select us.username, ur.userrolename user us, userrole ur ur.username =? " /> </security:authentication-provider> </security:authentication-manager> </beans>
Comments
Post a Comment