}
private SecuritySession createSession( String principal )
throws ArchivaSecurityException, AccessDeniedException
{
User user;
try
{
user = securitySystem.getUserManager().findUser( principal );
if ( user == null )
{
throw new ArchivaSecurityException(
"The security system had an internal error - please check your system logs" );
}
}
catch ( UserNotFoundException e )
{
throw new PrincipalNotFoundException( "Unable to find principal " + principal + "" );
}
if ( user.isLocked() )
{
throw new AccessDeniedException( "User " + principal + "(" + user.getFullName() + ") is locked." );
}
AuthenticationResult authn = new AuthenticationResult( true, principal, null );
return new DefaultSecuritySession( authn, user );
}