我们将Spring Security与RequestHeaderAuthenticationFilter结合使用,因此依赖于为用户名设置的HTTP头。在我们的本地机器上,我们没有用于身份验证的软件,因此没有标头。
当使用WebDriver或FireFox测试时,我们可以设置标头并正确测试,但当使用Internet Explorer手动测试时,我们无法设置标头的值。
有没有在IE中设置头值的好方法,或者在开发和测试中为过滤器启用某种“模拟”的好方法?
发布于 2010-09-15 19:29:31
在Spring上下文中设置exceptionIfMissingHeader属性。
在javadoc中:http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/web/authentication/preauth/RequestHeaderAuthenticationFilter.html
“如果请求中缺少标头,getPreAuthenticatedPrincipal将引发异常。您可以通过设置exceptionIfMissingHeader属性来覆盖此行为。”
https://stackoverflow.com/questions/3716972
复制相似问题