Package org.apache.archiva.redback.users

Examples of org.apache.archiva.redback.users.User


    protected HttpServletResponse httpServletResponse;

    protected AuditInformation getAuditInformation()
    {
        RedbackRequestInformation redbackRequestInformation = RedbackAuthenticationThreadLocal.get();
        User user = redbackRequestInformation == null ? null : redbackRequestInformation.getUser();
        String remoteAddr = redbackRequestInformation == null ? null : redbackRequestInformation.getRemoteAddr();
        return new AuditInformation( user, remoteAddr );
    }
View Full Code Here


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

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

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

            }

            @Override
            public User createGuestUser()
            {
                return new User()
                {

                    @Override
                    public String getUsername()
                    {
                        return "guest";
                    }

                    @Override
                    public void setUsername( String name )
                    {

                    }

                    @Override
                    public String getFullName()
                    {
                        return null;
                    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    @Override
                    public String getUserManagerId()
                    {
                        return "mock";
                    }
                };
            }

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

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

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

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

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

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

            @Override
            public User findUser( String username, boolean useCache )
                throws UserNotFoundException, UserManagerException
            {
                return null;
            }

            @Override
            public User getGuestUser()
                throws UserNotFoundException
            {
                return new User()
                {

                    @Override
                    public String getUsername()
                    {
View Full Code Here

    protected User createUser( String principal, String fullname )
        throws UserManagerException
    {
        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.getUsername() );

        // Setup Guest User.
        User guestUser = createUser( USER_GUEST, "Guest User" );
        roleManager.assignRole( ArchivaRoleConstants.TEMPLATE_GUEST, guestUser.getUsername() );
    }
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

    }

    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 + "", e );
        }
        catch ( UserManagerException e )
        {
            throw new ArchivaSecurityException( e.getMessage(), e );
        }

        if ( user.isLocked() )
        {
            throw new AccessDeniedException( "User " + principal + "(" + user.getFullName() + ") is locked." );
        }

        AuthenticationResult authn = new AuthenticationResult( true, principal, null );
        authn.setUser( user );
        return new DefaultSecuritySession( authn, user );
View Full Code Here

        createUser( USER_ALPACA, "Al 'Archiva' Paca" );

        assignRepositoryManagerRole( USER_ALPACA, "corporate" );

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

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

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

        //httpServletRequestControl.expectAndReturn( request.getRemoteAddr(), "192.168.111.111" );
        EasyMock.expect( request.getRemoteAddr() ).andReturn( "192.168.111.111" );

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

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

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

        createUser( USER_ALPACA, "Al 'Archiva' Paca" );

        assignRepositoryObserverRole( USER_ALPACA, "corporate" );

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

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

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

TOP

Related Classes of org.apache.archiva.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.