Package org.apache.isis.core.runtime.authentication

Examples of org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword


        Assert.assertTrue(saipSqlAuthenticator.isValid(request));
    }

    @Test
    public void VerifyThatIsValidReturnsFalseForNoPassword() {
        final AuthenticationRequestPassword request = new AuthenticationRequestPassword("user1", "");
        Assert.assertFalse(saipSqlAuthenticator.isValid(request));
    }
View Full Code Here


        Assert.assertFalse(saipSqlAuthenticator.isValid(request));
    }

    @Test
    public void VerifyThatIsValidReturnsFalseForWrongPassword() {
        final AuthenticationRequestPassword request = new AuthenticationRequestPassword("user1", "password12");
        Assert.assertFalse(saipSqlAuthenticator.isValid(request));
    }
View Full Code Here

        Assert.assertFalse(saipSqlAuthenticator.isValid(request));
    }

    @Test
    public void VerifyThatIsValidReturnsFalseForWrongUsername() {
        final AuthenticationRequestPassword request = new AuthenticationRequestPassword("user", "password1");
        Assert.assertFalse(saipSqlAuthenticator.isValid(request));
    }
View Full Code Here

        }
    }

    @Override
    public final boolean isValid(final AuthenticationRequest request) {
        final AuthenticationRequestPassword passwordRequest = (AuthenticationRequestPassword) request;
        final String username = passwordRequest.getName();
        if (Strings.isNullOrEmpty(username)) {
            return false;
        }
        final String password = passwordRequest.getPassword();
        Assert.assertNotNull(password);

        return isPasswordValidForUser(passwordRequest, username, password);

    }
View Full Code Here

    protected AuthenticationSession authenticate(final String user, final String password) {
        AuthenticationRequest request;
        if (getDeploymentType() == DeploymentType.EXPLORATION) {
            request = new AuthenticationRequestExploration();
        } else {
            request = new AuthenticationRequestPassword(user, password);
        }
        return getAuthenticationManager().authenticate(request);
    }
View Full Code Here

    }

    @Override
    public boolean authenticate(final String username, final String password) {
        AuthenticationRequest authenticationRequest;
        authenticationRequest = new AuthenticationRequestPassword(username, password);
        authenticationRequest.setRoles(Arrays.asList(USER_ROLE));
        authenticationSession = getAuthenticationManager().authenticate(authenticationRequest);
        return authenticationSession != null;
    }
View Full Code Here

        }

        final String user = matcher.group(1);
        final String password = matcher.group(2);

        final AuthenticationSession authSession = getAuthenticationManager().authenticate(new AuthenticationRequestPassword(user, password));
        return authSession;
    }
View Full Code Here

        }
        return roles;
    }

    private static AuthenticationToken asAuthenticationToken(final AuthenticationRequest request) {
        final AuthenticationRequestPassword passwordRequest = (AuthenticationRequestPassword) request;
        final String username = passwordRequest.getName();
        final String password = passwordRequest.getPassword();
       
        return new UsernamePasswordToken(username, password);
    }
View Full Code Here

    }

    @Override
    public boolean authenticate(final String username, final String password) {
        AuthenticationRequest authenticationRequest;
        authenticationRequest = new AuthenticationRequestPassword(username, password);
        authenticationRequest.setRoles(Arrays.asList(USER_ROLE));
        authenticationSession = getAuthenticationManager().authenticate(authenticationRequest);
        return authenticationSession != null;
    }
View Full Code Here

public class LdapAuthenticatorTester {

    public static void main(final String[] args) {
        final LdapAuthenticator auth = new LdapAuthenticator(IsisContext.getConfiguration());

        AuthenticationRequestPassword req = new AuthenticationRequestPassword("unauth", "pass");
        try {
            System.out.println("unauth auth=" + auth.isValid(req));
        } catch (final Exception e) {
            System.out.println("unauth failed authentication!");
            e.printStackTrace();
        }
        req = new AuthenticationRequestPassword("joe", "pass");
        try {
            System.out.println("joe auth=" + auth.isValid(req));
        } catch (final Exception e) {
            System.out.println("joe auth failed!!");
            e.printStackTrace();
        }
        req = new AuthenticationRequestPassword("joe", "wrongpass");
        try {
            System.out.println("joe wrongpass auth=" + auth.isValid(req));
        } catch (final Exception e) {
            System.out.println("joe wrongpass auth failed!!");
            e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword

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.