Examples of AuthenticationInfo


Examples of org.apache.sling.auth.core.spi.AuthenticationInfo

    private static final String CREDENTIALS = "user.jcr.credentials";

    @Test
    public void testClear() {
        final char[] pwd = new char[6];
        final AuthenticationInfo info = new AuthenticationInfo("test", "name",
            pwd);
        Assert.assertEquals("test", info.getAuthType());
        Assert.assertEquals("name", info.getUser());
        assertSame(pwd, info.getPassword());

        info.clear();

        Assert.assertEquals(1, info.size()); // AUTH_TYPE still contained
        Assert.assertEquals("test", info.getAuthType());
        assertFalse(info.containsKey(ResourceResolverFactory.USER));
        assertFalse(info.containsKey(ResourceResolverFactory.PASSWORD));
    }
View Full Code Here

Examples of org.apache.sling.auth.core.spi.AuthenticationInfo

        assertFalse(info.containsKey(ResourceResolverFactory.PASSWORD));
    }

    @Test
    public void testDOING_AUTH() {
        final AuthenticationInfo da = AuthenticationInfo.DOING_AUTH;
        Assert.assertEquals("DOING_AUTH", da.getAuthType());
        da.clear();
        Assert.assertEquals("DOING_AUTH", da.getAuthType());
        da.put("test", "test");
        assertFalse(da.containsKey("test"));
    }
View Full Code Here

Examples of org.apache.sling.auth.core.spi.AuthenticationInfo

        assertFalse(da.containsKey("test"));
    }

    @Test
    public void testFAIL_AUTH() {
        final AuthenticationInfo fa = AuthenticationInfo.FAIL_AUTH;
        Assert.assertEquals("FAIL_AUTH", fa.getAuthType());
        fa.clear();
        Assert.assertEquals("FAIL_AUTH", fa.getAuthType());
        fa.put("test", "test");
        assertFalse(fa.containsKey("test"));
    }
View Full Code Here

Examples of org.apache.sling.auth.core.spi.AuthenticationInfo

        assertFalse(fa.containsKey("test"));
    }

    @Test
    public void testAuthenticationInfoString() {
        final AuthenticationInfo info = new AuthenticationInfo("test");
        Assert.assertEquals("test", info.getAuthType());
        assertNull(info.getUser());
        assertNull(info.getPassword());
    }
View Full Code Here

Examples of org.apache.sling.auth.core.spi.AuthenticationInfo

        assertNull(info.getPassword());
    }

    @Test
    public void testAuthenticationInfoStringString() {
        final AuthenticationInfo info = new AuthenticationInfo("test", "name");
        Assert.assertEquals("test", info.getAuthType());
        Assert.assertEquals("name", info.getUser());
        assertNull(info.getPassword());
    }
View Full Code Here

Examples of org.apache.sling.auth.core.spi.AuthenticationInfo

    }

    @Test
    public void testAuthenticationInfoStringStringCharArray() {
        final char[] pwd = new char[6];
        final AuthenticationInfo info = new AuthenticationInfo("test", "name",
            pwd);
        Assert.assertEquals("test", info.getAuthType());
        Assert.assertEquals("name", info.getUser());
        assertSame(pwd, info.getPassword());
    }
View Full Code Here

Examples of org.apache.sling.auth.core.spi.AuthenticationInfo

    }

    @Test
    public void testAuthenticationInfoStringStringCharArrayString() {
        final char[] pwd = new char[6];
        final AuthenticationInfo info = new AuthenticationInfo("test", "name",
            pwd);
        Assert.assertEquals("test", info.getAuthType());
        Assert.assertEquals("name", info.getUser());
        assertSame(pwd, info.getPassword());
    }
View Full Code Here

Examples of org.apache.sling.auth.core.spi.AuthenticationInfo

        assertSame(pwd, info.getPassword());
    }

    @Test
    public void testSetAuthType() {
        final AuthenticationInfo info = new AuthenticationInfo("test");
        Assert.assertEquals("test", info.getAuthType());

        info.setAuthType(null);
        Assert.assertEquals("test", info.getAuthType());

        info.setAuthType("dummy");
        Assert.assertEquals("dummy", info.getAuthType());

        info.setAuthType("");
        Assert.assertEquals("", info.getAuthType());
    }
View Full Code Here

Examples of org.apache.sling.auth.core.spi.AuthenticationInfo

     * Session.
     */
    public AuthenticationInfo extractCredentials(HttpServletRequest request,
            HttpServletResponse response) {

        AuthenticationInfo info = null;

        // 1. try credentials from POST'ed request parameters
        info = this.extractRequestParameterAuthentication(request);

        // 2. try credentials from the cookie or session
View Full Code Here

Examples of org.apache.sling.auth.core.spi.AuthenticationInfo

    // --------- Request Parameter Auth ---------

    private AuthenticationInfo extractRequestParameterAuthentication(
            HttpServletRequest request) {
        AuthenticationInfo info = null;

        // only consider login form parameters if this is a POST request
        // to the j_security_check URL
        if (REQUEST_METHOD.equals(request.getMethod())
            && request.getRequestURI().endsWith(REQUEST_URL_SUFFIX)) {

            String user = request.getParameter(PAR_J_USERNAME);
            String pwd = request.getParameter(PAR_J_PASSWORD);

            if (user != null && pwd != null) {
                info = new AuthenticationInfo(HttpServletRequest.FORM_AUTH,
                    user, pwd.toCharArray());
                info.put(AuthConstants.AUTH_INFO_LOGIN, new Object());

                // if this request is providing form credentials, we have to
                // make sure, that the request is redirected after successful
                // authentication, otherwise the request may be processed
                // as a POST request to the j_security_check page (unless
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.