throw new CredentialsNotSetException(event, event.getSession().getSecurityContext(), this);
}
Credentials user = new MuleCredentials(userHeader, getSecurityManager());
Authentication authentication;
try
{
authentication = getSecurityManager().authenticate(new DefaultMuleAuthentication(user, event));
}
catch (Exception e)
{
// Authentication failed
if (logger.isDebugEnabled())
{
logger.debug("Authentication request for user: " + user.getUsername()
+ " failed: " + e.toString());
}
throw new UnauthorisedException(
CoreMessages.authFailedForUser(user.getUsername()), event, e);
}
// Authentication success
if (logger.isDebugEnabled())
{
logger.debug("Authentication success: " + authentication.toString());
}
SecurityContext context = getSecurityManager().createSecurityContext(authentication);
context.setAuthentication(authentication);
event.getSession().setSecurityContext(context);