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

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


        final String user = configuration.getString(SystemConstants.USER_KEY);
        final String password = configuration.getString(SystemConstants.PASSWORD_KEY);

        if (user != null) {
            authenticationRequestViaArgs = new AuthenticationRequestPassword(user, password);
        }
    }
View Full Code Here


        });
    }

    @Test
    public void newlyCreatedAuthenticationSessionShouldBeValid() throws Exception {
        final AuthenticationRequestPassword request = new AuthenticationRequestPassword("foo", "bar");
        final AuthenticationSession session = authenticationManager.authenticate(request);

        assertThat(authenticationManager.isSessionValid(session), is(true));
    }
View Full Code Here

        assertThat(authenticationManager.getAuthenticators().size(), is(0));
    }

    @Test(expected = NoAuthenticatorException.class)
    public void shouldNotBeAbleToAuthenticateWithNoAuthenticators() throws Exception {
        authenticationManager.authenticate(new AuthenticationRequestPassword("foo", "bar"));
    }
View Full Code Here

        this.resourceStreamSource = configuration.getResourceStreamSource();
    }

    @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);

        BufferedReader reader = null;
        try {
            final InputStream readStream = resourceStreamSource.readResource(FileAuthenticationConstants.PASSWORDS_FILE);
View Full Code Here

        } else if (widget == login || widget == password) {
            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            instructionLabel.setText("Authorising...");
            instructionLabel.setForeground(Color.BLACK);

            final AuthenticationRequestPassword authenticationRequest = new AuthenticationRequestPassword(getUser(), getPassword());
            session = authenticationManager.authenticate(authenticationRequest);
            if (session == null) {
                try {
                    Thread.sleep(750);
                } catch (final InterruptedException ignore) {
View Full Code Here

        request.setRoles(roles);
    }

    @Override
    public boolean isValid(final AuthenticationRequest request) {
        final AuthenticationRequestPassword passwordRequest = (AuthenticationRequestPassword) request;
        final String username = passwordRequest.getName();
        Assert.assertNotNull(username);
        if (username.equals("")) {
            LOG.debug("empty username");
            return false; // failed authentication
        }
        final String password = passwordRequest.getPassword();
        Assert.assertNotNull(password);

        final Hashtable<String, String> env = new Hashtable<String, String>(4);
        env.put(Context.INITIAL_CONTEXT_FACTORY, LdapAuthenticationConstants.SERVER_DEFAULT);
        env.put(Context.PROVIDER_URL, ldapProvider);
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

                } else {
                    session = context.getSession();
                }
               
            } else {
                session = UserManager.authenticate(new AuthenticationRequestPassword(username, password));
                isValid = session != null;
            }
        }

        String view;
View Full Code Here

    }

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

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

    @Test
    public void VerifyThatIsValidReturnsTrueInMixedCase() {
        final AuthenticationRequestPassword request = new AuthenticationRequestPassword("uSer1", "password1");
        Assert.assertTrue(saipSqlAuthenticator.isValid(request));
    }
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.