Package utils

Examples of utils.BasicAuthAction


        String password = "pass";
        String credential = "Basic "
                + new String(Base64.encodeBase64((loginId + ":" + password).getBytes("UTF-8")));
        User user = User.findByLoginId(loginId);
        Context context = context().withHeader(Http.HeaderNames.AUTHORIZATION, credential);
        BasicAuthAction action = new BasicAuthAction();
        action.delegate = mock(Action.class);

        // When
        action.call(context);

        // Then
        assertThat(context.session()).includes(
                entry(UserApp.SESSION_USERID, String.valueOf(user.id)),
                entry(UserApp.SESSION_LOGINID, user.loginId),
View Full Code Here


    @Test
    public void callAnonymous() throws Throwable {
        // Given
        Context context = context();
        BasicAuthAction action = new BasicAuthAction();
        action.delegate = mock(Action.class);

        // When
        action.call(context);

        // Then
        assertThat(context.session()).isEmpty();
        verify(action.delegate).call(context);
    }
View Full Code Here

TOP

Related Classes of utils.BasicAuthAction

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.