你是春天安全的新手。
我曾尝试过匿名用户访问该应用程序。 但现在我想实现匿名用户和经过身份验证的用户访问应用程序。可以任何人帮助我。
以下我用于匿名用户的security.xml。但现在我想实现匿名用户和经过身份验证的用户。(经过身份验证的用户会将注册用户的用户名和密码用于检查)
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<http pattern="/static/**" security="none" />
<http pattern="**/static/**" security="none" />
<http pattern="/w/login*" security="none" />
<http pattern="/w/about*" security="none" />
<http pattern="/w/getInvolved*" security="none" />
<http pattern="/w/faq*" security="none" />
<http pattern="/w/feedback*" security="none" />
<http pattern="/w/contact*" security="none" />
<http pattern="/w/privacy*" security="none" />
<http pattern="/w/terms*" security="none" />
<http auto-config='true' use-expressions="true">
<form-login login-page='/w/login' />
<intercept-url pattern="/w/**" access="isAnonymous()"/>
<intercept-url pattern="/a/**" access="isAnonymous()"/>
<logout logout-url="/w/logout" logout-success-url="/w/login" />
</http>
<authentication-manager>
<authentication-provider user-service-ref="twwiUserSQLMapDAO">
<password-encoder hash="sha"></password-encoder>
</authentication-provider>
</authentication-manager>
</beans:beans>
答案 0 :(得分:2)
如果您想授予经过身份验证和匿名用户的访问权限,可以使用permitAll:
<intercept-url pattern="/login/**" access="permitAll" />