【发布时间】:2013-06-11 12:24:30
【问题描述】:
我正在使用CustomAuthentication 提供程序进行身份验证,它扩展了AbstractUserDetailsAuthenticationProvider。我必须这样做,因为我想针对 Web 服务进行身份验证,并且需要用户 ID 和密码。这是唯一允许我这样做的课程。
现在我在实现记住我的功能时遇到了问题,这是我的安全上下文文件 -
<http auto-config="true">
<intercept-url pattern="/j_spring_security_check" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<intercept-url pattern="/dashboard*" access="ROLE_USER" />
<form-login login-page="/login.html" default-target-url="/dashboard1.html#meetings"
authentication-failure-url="/loginFailed.html" />
<logout logout-success-url="/login.html" />
</http>
<beans:bean name="customAuthenticationProvider" class = "com.component.WebServiceUserDetailsAuthenticationProvider"/>
<authentication-manager>
<authentication-provider ref = "customAuthenticationProvider"/>
</authentication-manager>
</beans:beans>
现在我正在尝试实现记住我,但它强制我拥有我无法拥有的用户详细信息服务,因为我需要用户名和密码来验证我的 Web 服务和 userdetailservice 公开的方法只提供用户名不密码,这就是我必须首先使用 customAuthentication 的原因。
【问题讨论】:
-
您实际上并没有说出您的问题是什么,因此您可能应该编辑您的问题以澄清。此外,您不需要扩展
AbstractUserDetailsAuthenticationProvider。你可以直接实现AuthenticationProvider接口。 -
嗨,卢克,我现在已经完成了我的问题。还有 AbstractUserDeta ..... 我之所以使用是因为我只想为方法 authenticate 提供实现,这就是 abstractUs.. 的用途。
标签: spring spring-security remember-me