[MNG-1106] guard against NPE which can be generated by the LDAP user manager if misconfigured

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@750953 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2009-03-06 16:08:12 +00:00
parent adf0f01d13
commit 4b34d911eb
2 changed files with 12 additions and 0 deletions

View File

@ -105,6 +105,10 @@ public class ArchivaServletAuthenticator
} }
User user = securitySystem.getUserManager().findUser( principal ); User user = securitySystem.getUserManager().findUser( principal );
if ( user == null )
{
throw new UnauthorizedException( "The security system had an internal error - please check your system logs" );
}
if ( user.isLocked() ) if ( user.isLocked() )
{ {
throw new UnauthorizedException( "User account is locked." ); throw new UnauthorizedException( "User account is locked." );

View File

@ -77,6 +77,10 @@ public class DefaultUserRepositories
try try
{ {
User user = securitySystem.getUserManager().findUser( principal ); User user = securitySystem.getUserManager().findUser( principal );
if ( user == null )
{
throw new ArchivaSecurityException( "The security system had an internal error - please check your system logs" );
}
if ( user.isLocked() ) if ( user.isLocked() )
{ {
@ -145,6 +149,10 @@ public class DefaultUserRepositories
try try
{ {
User user = securitySystem.getUserManager().findUser( principal ); User user = securitySystem.getUserManager().findUser( principal );
if ( user == null )
{
throw new ArchivaSecurityException( "The security system had an internal error - please check your system logs" );
}
if ( user.isLocked() ) if ( user.isLocked() )
{ {