我正在使用 Spring 3.1.1.RELEASE。如何在身份验证成功处理程序方法中访问原始请求对象?当我提交我的 spring 安全表单时,我提交了三个参数,用户名、密码和第三个令牌(param name = "token")。这个我试过了……</p>
@RequestMapping(value = "/authenticate")
public String authenticate()
{
final HttpServletRequest origRequest =
((ServletRequestAttributes) RequestContextHolder.
currentRequestAttributes()).getRequest();
String token = origRequest.getParameter("token");
但是,“token”的值始终为空,即使我在提交请求时知道它不是。以下是我配置 Spring 安全性的方法……</p>
<beans:bean id="springboardUsernamePasswordUrlAuthenticationFilter"
class="org.collegeboard.springboard.dido.security.SpringboardUsernamePasswordUrlAuthenticationFilter">
<beans:property name="filterProcessesUrl" value="/j_spring_security_check"/>
<beans:property name="authenticationManager" ref="authenticationManager"/>
<beans:property name="authenticationFailureHandler">
<beans:bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
<beans:property name="defaultFailureUrl" value="/login/failure"/>
</beans:bean>
</beans:property>
<beans:property name="authenticationSuccessHandler">
<beans:bean
class="org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler">
<beans:property name="defaultTargetUrl" value="/pdregistration/authenticate" />
</beans:bean>
</beans:property>
</beans:bean>
感谢您的帮助,-戴夫