Examples of AuthenticationInfo


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

    }

    @Test
    public void testGetPassword() {
        final char[] pwd = new char[6];
        final AuthenticationInfo info = new AuthenticationInfo("test", "name",
            pwd);

        assertSame(pwd, info.getPassword());
        assertEquals(pwd, (char[]) info.get(ResourceResolverFactory.PASSWORD));
        Assert.assertEquals(info.get(ResourceResolverFactory.PASSWORD),
            info.getPassword());
    }
View Full Code Here

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

        for (int m = 0; m < localArray.length; m++) {
            final Collection<AbstractAuthenticationHandlerHolder> local = localArray[m];
            if (local != null) {
                for (AbstractAuthenticationHandlerHolder holder : local) {
                    if (path.startsWith(holder.path)) {
                        final AuthenticationInfo authInfo = holder.extractCredentials(
                            request, response);

                        if (authInfo != null) {
                            // add the feedback handler to the info (may be null)
                            authInfo.put(AUTH_INFO_PROP_FEEDBACK_HANDLER,
                                holder.getFeedbackHandler());

                            return authInfo;
                        }
                    }
                }
            }
        }

        // check whether the HTTP Basic handler can extract the header
        if (httpBasicHandler != null) {
            final AuthenticationInfo authInfo = httpBasicHandler.extractCredentials(
                request, response);
            if (authInfo != null) {
                authInfo.put(AUTH_INFO_PROP_FEEDBACK_HANDLER, httpBasicHandler);
                return authInfo;
            }
        }

        // no handler found for the request ....
View Full Code Here

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

     * password are set according to the {@link #PAR_ANONYMOUS_USER} and
     * {@link #PAR_ANONYMOUS_PASSWORD} configurations. Otherwise
     * the user name and password fields are just <code>null</code>.
     */
    private AuthenticationInfo getAnonymousCredentials() {
        AuthenticationInfo info = new AuthenticationInfo(null);
        if (this.anonUser != null) {
            info.setUser(this.anonUser);
            info.setPassword(this.anonPassword);
        }
        return info;
    }
View Full Code Here

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

    }

    @Test
    public void testSetCredentials() {
        final Credentials creds = new SimpleCredentials("user", new char[0]);
        final AuthenticationInfo info = new AuthenticationInfo("test");

        info.put(CREDENTIALS, creds);
        Assert.assertSame(creds, info.get(CREDENTIALS));
    }
View Full Code Here

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

        Assert.assertSame(creds, info.get(CREDENTIALS));
    }

    @Test
    public void testGetCredentials() {
        final AuthenticationInfo info = new AuthenticationInfo("test");

        assertNull(info.get(CREDENTIALS));
        assertFalse(info.containsKey(CREDENTIALS));

        final Credentials creds = new SimpleCredentials("user", new char[0]);
        info.put(CREDENTIALS, creds);

        assertSame(creds, info.get(CREDENTIALS));

        final String user = "user";
        final char[] pwd = new char[5];
        final AuthenticationInfo infoCred = new AuthenticationInfo("TEST",
            user, pwd);

        // credentials not stored in the object
        assertFalse(infoCred.containsKey(CREDENTIALS));
    }
View Full Code Here

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

        assertFalse(infoCred.containsKey(CREDENTIALS));
    }

    @Test
    public void testRemoveObject() {
        final AuthenticationInfo info = new AuthenticationInfo("test");

        final Object value = "test";
        info.put("test", value);
        assertSame(value, info.get("test"));

        final Object removed = info.remove("test");
        assertSame(value, removed);
        assertFalse(info.containsKey("test"));

        assertNull(info.remove(AuthenticationInfo.AUTH_TYPE));
        Assert.assertEquals("test", info.get("sling.authType"));
        assertNull(info.remove("sling.authType"));
        Assert.assertEquals("test", info.getAuthType());
    }
View Full Code Here

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

        Assert.assertEquals("test", info.getAuthType());
    }

    @Test
    public void testPutStringObject() {
        final AuthenticationInfo info = new AuthenticationInfo("test", "user",
            new char[2]);
        info.put(CREDENTIALS,
                new SimpleCredentials("user", new char[2]));

        test_put_fail(info, AuthenticationInfo.AUTH_TYPE, null);
        test_put_fail(info, ResourceResolverFactory.USER, null);
        test_put_fail(info, ResourceResolverFactory.PASSWORD, null);
View Full Code Here

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

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

        // extract credentials and return
        AuthenticationInfo info = this.extractCredentials(request);
        if (info != null) {
            return info;
        }

        // no credentials, check whether the client wants to login
View Full Code Here

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

        } else {
            userId = decoded.substring(0, colIdx);
            password = decoded.substring(colIdx + 1).toCharArray();
        }

        return new AuthenticationInfo(HttpServletRequest.BASIC_AUTH, userId,
            password);
    }
View Full Code Here

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

            }
        }

        if (!StringUtils.isEmpty(hash) && !StringUtils.isEmpty(userId) && !StringUtils.isEmpty(user)) {
            logger.debug("valid cookies with hash and user data and id found");
            final AuthenticationInfo authenticationInfo = new AuthenticationInfo(XingLogin.AUTH_TYPE, userId);
            authenticationInfo.put(XingLogin.AUTHENTICATION_CREDENTIALS_HASH_KEY, hash);
            authenticationInfo.put(XingLogin.AUTHENTICATION_CREDENTIALS_USERDATA_KEY, user);
            return authenticationInfo;
        } else {
            logger.debug("unable to extract credentials from request");
            return null;
        }
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.