avoided race in FormAuth by not sending redirect until after session attribute set
This commit is contained in:
parent
e0276a8f65
commit
c1a454c278
|
@ -216,19 +216,20 @@ public class FormAuthenticator extends LoginAuthenticator
|
||||||
synchronized(session)
|
synchronized(session)
|
||||||
{
|
{
|
||||||
nuri = (String) session.getAttribute(__J_URI);
|
nuri = (String) session.getAttribute(__J_URI);
|
||||||
}
|
|
||||||
|
if (nuri == null || nuri.length() == 0)
|
||||||
if (nuri == null || nuri.length() == 0)
|
{
|
||||||
{
|
nuri = request.getContextPath();
|
||||||
nuri = request.getContextPath();
|
if (nuri.length() == 0)
|
||||||
if (nuri.length() == 0)
|
nuri = URIUtil.SLASH;
|
||||||
nuri = URIUtil.SLASH;
|
}
|
||||||
|
|
||||||
|
Authentication cached=new SessionAuthentication(getAuthMethod(),user,password);
|
||||||
|
session.setAttribute(SessionAuthentication.__J_AUTHENTICATED, cached);
|
||||||
}
|
}
|
||||||
response.setContentLength(0);
|
response.setContentLength(0);
|
||||||
response.sendRedirect(response.encodeRedirectURL(nuri));
|
response.sendRedirect(response.encodeRedirectURL(nuri));
|
||||||
|
|
||||||
Authentication cached=new SessionAuthentication(getAuthMethod(),user,password);
|
|
||||||
session.setAttribute(SessionAuthentication.__J_AUTHENTICATED, cached);
|
|
||||||
return new FormAuthentication(getAuthMethod(),user);
|
return new FormAuthentication(getAuthMethod(),user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue