Package org.codehaus.plexus.redback.users

Examples of org.codehaus.plexus.redback.users.User


        throws Exception
    {
        createUser( USER_ALPACA, "Al 'Archiva' Paca" );

        UserManager userManager = securitySystem.getUserManager();
        User user = userManager.findUser( USER_ALPACA );

        AuthenticationResult result = new AuthenticationResult( true, USER_ALPACA, null );

        SecuritySession session = new DefaultSecuritySession( result, user );
        try
View Full Code Here


    public boolean isAuthorized( String principal, String repoId, String permission )
        throws UnauthorizedException
    {
        try
        {
            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() )
            {
                throw new UnauthorizedException( "User account is locked." );
            }

            AuthenticationResult authn = new AuthenticationResult( true, principal, null );
View Full Code Here

        if ( securitySession == null )
        {
            return UserManager.GUEST_USERNAME;
        }

        User user = securitySession.getUser();
        if ( user == null )
        {
            return UserManager.GUEST_USERNAME;
        }

        return (String) user.getPrincipal();
    }
View Full Code Here

    }

    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 );
    }
View Full Code Here

    protected User createUser( String principal, String fullname )
    {
        UserManager userManager = securitySystem.getUserManager();

        User user = userManager.createUser( principal, fullname, principal + "@testable.archiva.apache.org" );
        securitySystem.getPolicy().setEnabled( false );
        userManager.addUser( user );
        securitySystem.getPolicy().setEnabled( true );

        return user;
View Full Code Here

        assertNotNull( roleManager );
        assertNotNull( userRepos );
        assertNotNull( archivaConfiguration );

        // Setup Admin User.
        User adminUser = createUser( USER_ADMIN, "Admin User" );
        roleManager.assignRole( ArchivaRoleConstants.TEMPLATE_SYSTEM_ADMIN, adminUser.getPrincipal().toString() );

        // Setup Guest User.
        User guestUser = createUser( USER_GUEST, "Guest User" );
        roleManager.assignRole( ArchivaRoleConstants.TEMPLATE_GUEST, guestUser.getPrincipal().toString() );
    }
View Full Code Here

        AuthenticationResult result = new AuthenticationResult();
        httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
        servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, null ), true );

        User user = new SimpleUser();
        user.setUsername( "admin" );
       
        // ArchivaDavResourceFactory#isAuthorized()
        SecuritySession session = new DefaultSecuritySession();
        httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
        httpAuthControl.expectAndReturn( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ), session );
View Full Code Here

    private Registry registry;

    protected void triggerAuditEvent( String repositoryId, String resource, String action,
                                      AuditInformation auditInformation )
    {
        User user = auditInformation == null ? null : auditInformation.getUser();
        AuditEvent event =
            new AuditEvent( repositoryId, user == null ? "null" : (String) user.getPrincipal(), resource, action );
        event.setRemoteIP( auditInformation == null ? "null" : auditInformation.getRemoteAddr() );

        for ( AuditListener listener : getAuditListeners() )
        {
            listener.auditEvent( event );
View Full Code Here

        if ( users.get( source.getPrincipal() ) != null )
        {
            result = new AuthenticationResult( true, source.getPrincipal(), null );

            User user = new JdoUser();
            user.setUsername( source.getPrincipal() );
            user.setPassword( users.get( source.getPrincipal() ) );

            session = new DefaultSecuritySession( result, user );
        }
        else
        {
View Full Code Here

                return null//To change body of implemented methods use File | Settings | File Templates.
            }

            public User createGuestUser()
            {
                return new User()
                {
                    public Object getPrincipal()
                    {
                        return "guest";
                    }

                    public String getUsername()
                    {
                        return null//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setUsername( String name )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public String getFullName()
                    {
                        return null//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setFullName( String name )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public String getEmail()
                    {
                        return null//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setEmail( String address )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public String getPassword()
                    {
                        return null//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setPassword( String rawPassword )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public String getEncodedPassword()
                    {
                        return null//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setEncodedPassword( String encodedPassword )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public Date getLastPasswordChange()
                    {
                        return null//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setLastPasswordChange( Date passwordChangeDate )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public List<String> getPreviousEncodedPasswords()
                    {
                        return null//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setPreviousEncodedPasswords( List<String> encodedPasswordList )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void addPreviousEncodedPassword( String encodedPassword )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public boolean isPermanent()
                    {
                        return false//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setPermanent( boolean permanent )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public boolean isLocked()
                    {
                        return false//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setLocked( boolean locked )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public boolean isPasswordChangeRequired()
                    {
                        return false//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setPasswordChangeRequired( boolean changeRequired )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public boolean isValidated()
                    {
                        return false//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setValidated( boolean valid )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public int getCountFailedLoginAttempts()
                    {
                        return 0//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setCountFailedLoginAttempts( int count )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public Date getAccountCreationDate()
                    {
                        return null//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setAccountCreationDate( Date date )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }

                    public Date getLastLoginDate()
                    {
                        return null//To change body of implemented methods use File | Settings | File Templates.
                    }

                    public void setLastLoginDate( Date date )
                    {
                        //To change body of implemented methods use File | Settings | File Templates.
                    }
                };
            }

            public UserQuery createUserQuery()
            {
                return null//To change body of implemented methods use File | Settings | File Templates.
            }

            public List<User> getUsers()
            {
                return null//To change body of implemented methods use File | Settings | File Templates.
            }

            public List<User> getUsers( boolean orderAscending )
            {
                return null//To change body of implemented methods use File | Settings | File Templates.
            }

            public User addUser( User user )
            {
                return null//To change body of implemented methods use File | Settings | File Templates.
            }

            public User updateUser( User user )
                throws UserNotFoundException
            {
                return null//To change body of implemented methods use File | Settings | File Templates.
            }

            public User findUser( String username )
                throws UserNotFoundException
            {
                return null//To change body of implemented methods use File | Settings | File Templates.
            }

            public User getGuestUser()
                throws UserNotFoundException
            {
                return new User()
                {
                    public Object getPrincipal()
                    {
                        return "guest";
                    }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.redback.users.User

Copyright © 2018 www.massapicom. 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.