Examples of AuthorizationResult


Examples of org.apache.archiva.redback.authorization.AuthorizationResult

    }

    public AuthorizationResult authorize( SecuritySession arg0, Object arg1, Object arg2 )
        throws AuthorizationException
    {
        AuthorizationResult result = new AuthorizationResult( true, arg1, null );

        return result;
    }
View Full Code Here

Examples of org.apache.archiva.redback.authorization.AuthorizationResult

                                 String permission )
        throws AuthorizationException, UnauthorizedException
    {
        // TODO: also check for permission to proxy the resource when MRM-579 is implemented

        AuthorizationResult authzResult = securitySystem.authorize( securitySession, permission, repositoryId );

        if ( !authzResult.isAuthorized() )
        {
            if ( authzResult.getException() != null )
            {
                log.info( "Authorization Denied [ip=" + request.getRemoteAddr() + ",permission=" + permission + ",repo="
                              + repositoryId + "] : " + authzResult.getException().getMessage() );

                throw new UnauthorizedException( "Access denied for repository " + repositoryId );
            }
            throw new UnauthorizedException( "User account is locked" );
        }
View Full Code Here

Examples of org.codehaus.plexus.redback.authorization.AuthorizationResult

            SecuritySession session =
                authenticate( new PasswordBasedAuthenticationDataSource( username,
                                                                         config.getBasicPassword() ) );
           
            String method = pRequest.getMethodName();           
            AuthorizationResult result = authorize( session, method, username );
           
            return result.isAuthorized();
        }

        throw new XmlRpcException( "Unsupported transport (must be http)" );
    }
View Full Code Here

Examples of org.codehaus.plexus.redback.authorization.AuthorizationResult

                try
                {
                    List<String> observableRepos = userRepositories.getObservableRepositoryIds( username );
                    if( observableRepos != null && observableRepos.size() > 1 )
                    {
                        return new AuthorizationResult( true, username, null );
                    }
                    else
                    {
                        return new AuthorizationResult( false, username, null );
                    }
                }
                catch ( ArchivaSecurityException e )
                {
                    throw new XmlRpcException( 401, e.getMessage() );
                }
            }
            else if ( methodName.equals( ServiceMethodsPermissionsMapping.PING ) )
            {
                return new AuthorizationResult( true, username, null );
            }
            else
            {
                return securitySystem.authorize( session, ArchivaRoleConstants.GLOBAL_REPOSITORY_MANAGER_ROLE );
            }
View Full Code Here

Examples of org.codehaus.plexus.redback.authorization.AuthorizationResult

        if ( isWriteRequest )
        {
            permission = ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD;
        }

        AuthorizationResult authzResult = securitySystem.authorize( securitySession, permission, repositoryId );

        if ( !authzResult.isAuthorized() )
        {
            if ( authzResult.getException() != null )
            {
                log.info( "Authorization Denied [ip=" + request.getRemoteAddr() + ",isWriteRequest=" + isWriteRequest +
                    ",permission=" + permission + ",repo=" + repositoryId + "] : " +
                    authzResult.getException().getMessage() );

                throw new UnauthorizedException( "Access denied for repository " + repositoryId );
            }
            throw new UnauthorizedException( "User account is locked" );
        }
View Full Code Here

Examples of org.codehaus.plexus.redback.authorization.AuthorizationResult

    }

    public AuthorizationResult authorize( SecuritySession session, Object permission )
        throws AuthorizationException
    {
        return new AuthorizationResult( true, session.getUser(), null );
    }
View Full Code Here

Examples of org.codehaus.plexus.redback.authorization.AuthorizationResult

    }

    public AuthorizationResult authorize( SecuritySession session, Object permission, Object resource )
        throws AuthorizationException
    {
        return new AuthorizationResult( true, session.getUser(), null );
    }
View Full Code Here

Examples of org.codehaus.plexus.redback.authorization.AuthorizationResult

                                 String permission )
        throws AuthorizationException, UnauthorizedException
    {
        // TODO: also check for permission to proxy the resource when MRM-579 is implemented

        AuthorizationResult authzResult = securitySystem.authorize( securitySession, permission, repositoryId );

        if ( !authzResult.isAuthorized() )
        {
            if ( authzResult.getException() != null )
            {
                log.info( "Authorization Denied [ip=" + request.getRemoteAddr() + ",permission=" + permission
                    + ",repo=" + repositoryId + "] : " + authzResult.getException().getMessage() );

                throw new UnauthorizedException( "Access denied for repository " + repositoryId );
            }
            throw new UnauthorizedException( "User account is locked" );
        }
View Full Code Here

Examples of org.codehaus.plexus.redback.authorization.AuthorizationResult

    }

    public AuthorizationResult authorize( SecuritySession arg0, Object arg1, Object arg2 )
        throws AuthorizationException
    {
        AuthorizationResult result = new AuthorizationResult( true, arg1, null );

        return result;
    }
View Full Code Here

Examples of org.codehaus.plexus.redback.authorization.AuthorizationResult

    private boolean operationAllowed( String permission, String repoid )
    {
        ActionContext context = ActionContext.getContext();
        SecuritySession securitySession = (SecuritySession) context.get( SecuritySession.ROLE );

        AuthorizationResult authzResult;
        try
        {
            authzResult = securitySystem.authorize( securitySession, permission, repoid );

            return authzResult.isAuthorized();
        }
        catch ( AuthorizationException e )
        {
            getLogger().info(
                              "Unable to authorize permission: " + permission + " against repo: " + repoid
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.