0
我有一个网站,其登录表单看起来像这样。Safari Autopassword为空字符串
<h:panelGrid columns="3">
<p:outputLabel value="Username:" for="username"/>
<p:inputText id="username" autocomplete="off" />
<p:message for="username"/>
<p:outputLabel value="Password:" for="password"/>
<p:password id="password" />
<p:message for="password"/>
</h:panelGrid>
我们正在使用Spring安全来验证密码,当我在春天的UsernamePasswordAuthenticationFilter抛出一个破发点,使用Safari的自动填充密码功能时,密码总是空白。这会导致登录失败。
仅供参考,这里是我的破发点位于
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
if (postOnly && !request.getMethod().equals("POST")) {
throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod());
}
String username = obtainUsername(request);
String password = obtainPassword(request);
if (username == null) {
username = "";
}
//My breakpoint is here, but password = "" even though we have a user name
if (password == null) {
password = "";
}
username = username.trim();
UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password);
// Allow subclasses to set the "details" property
setDetails(request, authRequest);
return this.getAuthenticationManager().authenticate(authRequest);
}
我在一个总损失什么,我可以检查来解决这个Spring的代码部分。此密码问题仅影响Safari。其他浏览器,如IE,Chrome,FF工作得很好。
你如何提交你的表单?,你正在处理你的'p:password'吗? –