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 = UserUtility.getAnonymousId(getUserConfiguration().getConfigurationParameters());
            assertEquals(anonymousID, authInfo.getUserID());
        } finally {
            cs.close();
        }
    }
View Full Code Here


        try {
            user = userManager.createUser("test", "pw");
            root.commit();

            cs = login(new SimpleCredentials("test", "pw".toCharArray()));
            AuthInfo authInfo = cs.getAuthInfo();
            assertEquals("test", authInfo.getUserID());
        } finally {
            if (user != null) {
                user.remove();
                root.commit();
            }
View Full Code Here

            root.commit();

            SimpleCredentials sc = new SimpleCredentials("test", "pw".toCharArray());
            cs = login(sc);

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

            cs.close();

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

            authInfo = cs.getAuthInfo();
            assertEquals("test", authInfo.getUserID());
        } finally {
            if (user != null) {
                user.remove();
                root.commit();
            }
View Full Code Here

            root.commit();

            SimpleCredentials sc = new SimpleCredentials("test", "pw".toCharArray());
            cs = login(sc);

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

            cs.close();
            cs = null;

            String adminId = UserUtility.getAdminId(securityProvider.getUserConfiguration().getConfigurationParameters());
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

                    success = PasswordUtility.isSame(((CredentialsImpl) userCreds).getPasswordHash(), creds.getPassword());
                }
                checkSuccess(success, "UserId/Password mismatch.");
            } else if (credentials instanceof ImpersonationCredentials) {
                ImpersonationCredentials ipCreds = (ImpersonationCredentials) credentials;
                AuthInfo info = ipCreds.getImpersonatorInfo();
                success = equalUserId(ipCreds) && impersonate(info, user);
                checkSuccess(success, "Impersonation not allowed.");
            } else {
                // guest login is allowed if an anonymous user exists in the content (see get user above)
                success = (credentials instanceof GuestCredentials);
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

        try {
            user = userManager.createUser("test", "pw");
            root.commit();

            cs = login(new SimpleCredentials("test", "pw".toCharArray()));
            AuthInfo authInfo = cs.getAuthInfo();
            assertEquals("test", authInfo.getUserID());
        } finally {
            if (user != null) {
                user.remove();
                root.commit();
            }
View Full Code Here

            root.commit();

            SimpleCredentials sc = new SimpleCredentials("test", "pw".toCharArray());
            cs = login(sc);

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

            cs.close();

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

            authInfo = cs.getAuthInfo();
            assertEquals("test", authInfo.getUserID());
        } finally {
            if (user != null) {
                user.remove();
                root.commit();
            }
View Full Code Here

            root.commit();

            SimpleCredentials sc = new SimpleCredentials("test", "pw".toCharArray());
            cs = login(sc);

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

            cs.close();
            cs = null;

            String adminId = UserUtility.getAdminId(securityProvider.getUserConfiguration().getConfigurationParameters());
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.