mirror of
https://github.com/apache/archiva.git
synced 2025-02-21 01:15:08 +00:00
preserve stack trace
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1374660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
62b8b1854d
commit
01c3aee959
@ -318,7 +318,7 @@ public Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest )
|
||||
}
|
||||
catch ( UserNotFoundException e )
|
||||
{
|
||||
throw new ArchivaRestServiceException( "user " + userName + " not found", null );
|
||||
throw new ArchivaRestServiceException( "user " + userName + " not found", e );
|
||||
}
|
||||
|
||||
// check karma on source : read
|
||||
|
@ -19,9 +19,6 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.archiva.redback.authentication.AuthenticationException;
|
||||
import org.apache.archiva.redback.authentication.AuthenticationResult;
|
||||
import org.apache.archiva.redback.authorization.AuthorizationException;
|
||||
@ -38,10 +35,13 @@
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Service("servletAuthenticator")
|
||||
@Service( "servletAuthenticator" )
|
||||
public class ArchivaServletAuthenticator
|
||||
implements ServletAuthenticator
|
||||
{
|
||||
@ -76,8 +76,8 @@ public boolean isAuthorized( HttpServletRequest request, SecuritySession securit
|
||||
{
|
||||
if ( authzResult.getException() != null )
|
||||
{
|
||||
log.info( "Authorization Denied [ip=" + request.getRemoteAddr() + ",permission=" + permission
|
||||
+ ",repo=" + repositoryId + "] : " + authzResult.getException().getMessage() );
|
||||
log.info( "Authorization Denied [ip=" + request.getRemoteAddr() + ",permission=" + permission + ",repo="
|
||||
+ repositoryId + "] : " + authzResult.getException().getMessage() );
|
||||
|
||||
throw new UnauthorizedException( "Access denied for repository " + repositoryId );
|
||||
}
|
||||
@ -95,7 +95,8 @@ public boolean isAuthorized( String principal, String repoId, String permission
|
||||
User user = securitySystem.getUserManager().findUser( principal );
|
||||
if ( user == null )
|
||||
{
|
||||
throw new UnauthorizedException( "The security system had an internal error - please check your system logs" );
|
||||
throw new UnauthorizedException(
|
||||
"The security system had an internal error - please check your system logs" );
|
||||
}
|
||||
if ( user.isLocked() )
|
||||
{
|
||||
@ -109,11 +110,11 @@ public boolean isAuthorized( String principal, String repoId, String permission
|
||||
}
|
||||
catch ( UserNotFoundException e )
|
||||
{
|
||||
throw new UnauthorizedException( e.getMessage() );
|
||||
throw new UnauthorizedException( e.getMessage(), e );
|
||||
}
|
||||
catch ( AuthorizationException e )
|
||||
{
|
||||
throw new UnauthorizedException( e.getMessage() );
|
||||
throw new UnauthorizedException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,6 @@
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.beans.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.archiva.redback.users.UserNotFoundException;
|
||||
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
||||
import org.apache.archiva.redback.authentication.AuthenticationResult;
|
||||
import org.apache.archiva.redback.authorization.AuthorizationException;
|
||||
import org.apache.archiva.redback.role.RoleManager;
|
||||
@ -33,6 +30,9 @@
|
||||
import org.apache.archiva.redback.system.DefaultSecuritySession;
|
||||
import org.apache.archiva.redback.system.SecuritySession;
|
||||
import org.apache.archiva.redback.system.SecuritySystem;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.archiva.redback.users.UserNotFoundException;
|
||||
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -43,10 +43,8 @@
|
||||
|
||||
/**
|
||||
* DefaultUserRepositories
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Service( "userRepositories" )
|
||||
@Service("userRepositories")
|
||||
public class DefaultUserRepositories
|
||||
implements UserRepositories
|
||||
{
|
||||
@ -153,7 +151,7 @@ private SecuritySession createSession( String principal )
|
||||
}
|
||||
catch ( UserNotFoundException e )
|
||||
{
|
||||
throw new PrincipalNotFoundException( "Unable to find principal " + principal + "" );
|
||||
throw new PrincipalNotFoundException( "Unable to find principal " + principal + "", e );
|
||||
}
|
||||
|
||||
if ( user.isLocked() )
|
||||
|
Loading…
x
Reference in New Issue
Block a user