저는 스프링 보안 3.0.2를 사용하고 있으며 데이터베이스에서 익명 사용자의 역할을로드하는 방법을 찾을 수 없습니다 (나는 모든 사람에게 역할을 부여 할 수있는 동적 역할을 가지고 있습니다).봄 보안 3에서 익명 사용자에 대한 데이터베이스에서 역할을로드하는 방법은 무엇입니까?
사용자 지정 anonymousAuthenticationProvider를 사용하려고했지만이 공급자는 호출되지 않습니다. 내 설정은 다음과 같습니다.
<http auto-config="false">
<logout invalidate-session="true" logout-success-url="/page/welcome" />
<remember-me />
<anonymous username="_GUEST_" granted-authority="ROLE_GUEST" key="anonymousKey" />
<form-login login-page="/page/login" authentication-failure-url="/page/login?fail=1" default-target-url="/page/welcome" />
</http>
<authentication-manager alias="authenticationManager">
<authentication-provider ref="anonymousAuthenticationProvider"></authentication-provider>
<authentication-provider user-service-ref="accountDetails">
<password-encoder ref="passwordEncoder">
<salt-source user-property="xxxx" />
</password-encoder>
</authentication-provider>
</authentication-manager>
<beans:bean id="accountDetails" class="com.mysite.AccountDetailsImpl" />
<beans:bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder">
<beans:constructor-arg value="512" />
</beans:bean>
<beans:bean id="anonymousAuthenticationProvider" class="com.my.site.security.CustomAnonymousAuthenticationProvider">
<beans:property name="key" value="anonymousKey" />
</beans:bean>
데이터베이스에서 사용자 지정 권한을로드 할 수 없도록 내 anonymousAuthenticationProvider가 호출되지 않습니다. 로그인하면 내 서비스 accountDetails가 호출되며 사용자의 데이터베이스에서 역할을로드 할 수 있습니다. 익명 사용자에 대해서도 같은 것을 원합니다.
어떻게하면됩니까? 덕분에
얘들 아, 저도 같은 문제에있어. 질문은 사용자 정의 인증에 사용할 쿼리 문자열에서받은 매개 변수를 보낼 수 있습니까? 그렇다면 어떻게? 당신은 완전한 XML을 넣을 수 있습니까? Tks 많이! 여기에 설명 된대로 봄 보안 4 AnonymousAuthenticationFilter에서 로드리고 –