Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.AuthInfo


    @Test
    public void testGuestLogin() throws Exception {
        ContentSession cs = login(new GuestCredentials());
        try {
            AuthInfo authInfo = cs.getAuthInfo();
            String anonymousID = UserUtil.getAnonymousId(getUserConfiguration().getParameters());
            assertEquals(anonymousID, authInfo.getUserID());
        } finally {
            cs.close();
        }
    }
View Full Code Here


    @Test
    public void testGuestLogin() throws Exception {
        ContentSession cs = login(new GuestCredentials());
        try {
            AuthInfo authInfo = cs.getAuthInfo();
            String anonymousID = UserUtil.getAnonymousId(getUserConfiguration().getParameters());
            assertEquals(anonymousID, authInfo.getUserID());
        } finally {
            cs.close();
        }
    }
View Full Code Here

        ContentSession cs = null;
        try {
            createTestUser();

            cs = login(new SimpleCredentials(USER_ID, USER_PW.toCharArray()));
            AuthInfo authInfo = cs.getAuthInfo();
            assertEquals(USER_ID, authInfo.getUserID());
        } finally {
            if (cs != null) {
                cs.close();
            }
        }
View Full Code Here

            createTestUser();

            SimpleCredentials sc = new SimpleCredentials(USER_ID, USER_PW.toCharArray());
            cs = login(sc);

            AuthInfo authInfo = cs.getAuthInfo();
            assertEquals(USER_ID, authInfo.getUserID());

            cs.close();

            sc = new SimpleCredentials(USER_ID, new char[0]);
            ImpersonationCredentials ic = new ImpersonationCredentials(sc, authInfo);
            cs = login(ic);

            authInfo = cs.getAuthInfo();
            assertEquals(USER_ID, authInfo.getUserID());
        } finally {
            if (cs != null) {
                cs.close();
            }
        }
View Full Code Here

            createTestUser();

            SimpleCredentials sc = new SimpleCredentials(USER_ID, USER_PW.toCharArray());
            cs = login(sc);

            AuthInfo authInfo = cs.getAuthInfo();
            assertEquals(USER_ID, authInfo.getUserID());

            cs.close();
            cs = null;

            ConfigurationParameters config = securityProvider.getConfiguration(UserConfiguration.class).getParameters();
View Full Code Here

            SimpleCredentials sc = new SimpleCredentials(USER_ID, USER_PW.toCharArray());
            sc.setAttribute("attr", "value");

            cs = login(sc);

            AuthInfo authInfo = cs.getAuthInfo();
            assertTrue(Arrays.asList(authInfo.getAttributeNames()).contains("attr"));
            assertEquals("value", authInfo.getAttribute("attr"));

            cs.close();
        } finally {
            if (cs != null) {
                cs.close();
View Full Code Here

        try {
            createTestUser();

            SimpleCredentials sc = new SimpleCredentials(USER_ID, USER_PW.toCharArray());
            cs = login(sc);
            AuthInfo authInfo = cs.getAuthInfo();
            cs.close();
            cs = null;

            sc = new SimpleCredentials(USER_ID, new char[0]);
            sc.setAttribute("attr", "value");
            ImpersonationCredentials ic = new ImpersonationCredentials(sc, authInfo);
            cs = login(ic);

            authInfo = cs.getAuthInfo();
            assertTrue(Arrays.asList(authInfo.getAttributeNames()).contains("attr"));
            assertEquals("value", authInfo.getAttribute("attr"));
        } finally {
            if (cs != null) {
                cs.close();
            }
        }
View Full Code Here

        }
    }

    @Test
    public void testValidSubjectWithAuthInfo() throws Exception {
        AuthInfo info = new AuthInfoImpl("testUserId", Collections.<String, Object>emptyMap(), Collections.<Principal>emptySet());
        Set<AuthInfo> publicCreds = Collections.singleton(info);
        final Subject subject = new Subject(false, Collections.singleton(new TestPrincipal()), publicCreds, Collections.<Object>emptySet());
        ContentSession cs = Subject.doAsPrivileged(subject, new PrivilegedAction<ContentSession>() {
            @Override
            public ContentSession run() {
View Full Code Here

    @Test
    public void testNullLogin() throws Exception {
        ContentSession cs = login(null);
        try {
            AuthInfo authInfo = cs.getAuthInfo();
            String anonymousID = UserUtility.getAnonymousId(getUserConfiguration().getConfigurationParameters());
            assertEquals(anonymousID, authInfo.getUserID());
        } finally {
            cs.close();
        }
    }
View Full Code Here

    @Test
    public void testGuestLogin() throws Exception {
        ContentSession cs = login(new GuestCredentials());
        try {
            AuthInfo authInfo = cs.getAuthInfo();
            String anonymousID = UserUtility.getAnonymousId(getUserConfiguration().getConfigurationParameters());
            assertEquals(anonymousID, authInfo.getUserID());
        } finally {
            cs.close();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.api.AuthInfo

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.