if (logger.isDebugEnabled())
{
logger.debug("Authentication request for user: " + username + " failed: " + e.toString());
}
setUnauthenticated(event);
throw new UnauthorisedException(CoreMessages.authFailedForUser(username), e);
}
// Authentication success
if (logger.isDebugEnabled())
{
logger.debug("Authentication success: " + authResult.toString());
}
SecurityContext context = getSecurityManager().createSecurityContext(authResult);
context.setAuthentication(authResult);
event.getSession().setSecurityContext(context);
}
else if (header == null)
{
setUnauthenticated(event);
throw new UnauthorisedException(event, event.getSession().getSecurityContext(), this);
}
else
{
setUnauthenticated(event);
throw new UnsupportedAuthenticationSchemeException(