Package org.openengsb.connector.usernamepassword

Examples of org.openengsb.connector.usernamepassword.Password


                userManager.createUser("test");
                userManager.setUserCredentials("test", "password", "password");
                return null;
            }
        });
        Authentication authenticate = authenticator.authenticate("test", new Password("password"));
        assertThat(authenticate, not(nullValue()));
    }
View Full Code Here


        when(authenticationManager.authenticate(anyString(), any(Credentials.class))).thenAnswer(
            new Answer<Authentication>() {
                @Override
                public Authentication answer(InvocationOnMock invocation) throws Throwable {
                    String user = (String) invocation.getArguments()[0];
                    Password credentials = (Password) invocation.getArguments()[1];
                    if ("user".equals(user) && credentials.getValue().equals("password")) {
                        return new Authentication(user, credentials.toString());
                    }
                    throw new AuthenticationException("username and password did not match");
                }
            });
        PrivateKeySource keySource = mock(PrivateKeySource.class);
View Full Code Here

     * @return a SecureRequest corresponding to the given ServiceId and MethodId
     */
    private MethodCallMessage createSecureRequest(ServiceId serviceId, MethodId methodId)
        throws ArgumentConversionException {
        MethodCallMessage methodCallRequest = createMethodCallRequest(serviceId, methodId);
        BeanDescription beanDescription = BeanDescription.fromObject(new Password("yourpassword"));
        methodCallRequest.setPrincipal("yourusername");
        methodCallRequest.setCredentials(beanDescription);
        return methodCallRequest;
    }
View Full Code Here

        MethodResultMessage mr = response;
        assertThat((String) mr.getResult().getArg(), is(METHOD_ARG));
    }

    protected MethodCallMessage prepareSecureRequest() {
        return prepareSecureRequest("test", new Password("password"));
    }
View Full Code Here

        result.get();
    }

    private void authenticate(String user, String password) {
        Subject subject = SecurityUtils.getSubject();
        subject.login(new OpenEngSBAuthenticationToken(user, new Password(password)));
    }
View Full Code Here

        factory.applyAttributes((Connector) authManager, attributes);
    }

    @Test
    public void authenticateUsernamePassword_shouldAuthenticateSuccessful() throws Exception {
        Authentication authenticate = passwordAuthenticator.authenticate("testuser", new Password("password"));
        assertThat(authenticate.getUsername(), is("testuser"));
    }
View Full Code Here

        assertThat(authenticate.getUsername(), is("testuser"));
    }

    @Test(expected = AuthenticationException.class)
    public void authenticateUsernamePassword_shouldFail() throws Exception {
        passwordAuthenticator.authenticate("testuser", new Password("password2"));
    }
View Full Code Here

        onetimeAuthenticator.authenticate("testuser", new OneTimeValue(123));
    }

    @Test
    public void authenticateUsernamePasswordAtManager_shouldAuthenticateSuccessful() throws Exception {
        Authentication authenticate = authManager.authenticate("testuser", new Password("password"));
        assertThat(authenticate.getUsername(), is("testuser"));
    }
View Full Code Here

        assertThat(authenticate.getUsername(), is("testuser"));
    }

    @Test(expected = AuthenticationException.class)
    public void authenticateUsernamePasswordAtManager_shouldFail() throws Exception {
        authManager.authenticate("testuser", new Password("password2"));
    }
View Full Code Here

    protected void authenticateAsAdmin() throws InterruptedException, AuthenticationException {
        authenticate("admin", "password");
    }

    protected void authenticate(String user, String password) throws InterruptedException, AuthenticationException {
        authenticationContext.login(user, new Password(password));
    }
View Full Code Here

TOP

Related Classes of org.openengsb.connector.usernamepassword.Password

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.