Package org.apache.jackrabbit.oak.spi.security.principal

Examples of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl


     * @see <a href="https://issues.apache.org/jira/browse/OAK-2243">OAK-2243</a>
     */
    @Test
    public void testNameMatch2() throws RepositoryException {
        // create a user with different id and principal name
        User user = userMgr.createUser("moloch", null, new PrincipalImpl("MolochHorridus"), "reptiles");
        String userPath = user.getPath();
        // move it such that the node name doesn't reveal the id.
        superuser.move(userPath, Text.getRelativeParent(userPath, 1) + "/thorny_dragon");
        superuser.save();
        authorizables.add(user);
View Full Code Here


    @Override
    public void visit(Condition.Impersonation condition) {
        String principalName = condition.getName();
        boolean isAdmin = false;
        try {
            Authorizable authorizable = userMgr.getAuthorizable(new PrincipalImpl(principalName));
            isAdmin = authorizable != null && !authorizable.isGroup() && ((User) authorizable).isAdmin();
        } catch (RepositoryException e) {
            // unable to retrieve authorizable
        }
        if (isAdmin) {
View Full Code Here

            deny(UserConstants.DEFAULT_GROUP_PATH, privilegesFromName(Privilege.JCR_READ));

            Privilege[] privs = privilegesFromNames(new String[]{Privilege.JCR_READ, PrivilegeConstants.REP_USER_MANAGEMENT, PrivilegeConstants.REP_WRITE});
            allow(path, privs);

            Group gr = getUserManager(testSession).createGroup(groupId, new PrincipalImpl(groupId), "a/b/c");
            testSession.save();
        } finally {
            superuser.refresh(false);
            superuser.getNode(UserConstants.DEFAULT_GROUP_PATH + "/a").remove();
            JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(acMgr, UserConstants.DEFAULT_GROUP_PATH);
View Full Code Here

            deny(UserConstants.DEFAULT_GROUP_PATH, privilegesFromName(Privilege.JCR_READ));

            Privilege[] privs = privilegesFromNames(new String[]{Privilege.JCR_READ, PrivilegeConstants.REP_USER_MANAGEMENT, PrivilegeConstants.REP_WRITE});
            allow(path, privs);

            Group gr = getUserManager(testSession).createGroup(groupId, new PrincipalImpl(groupId), "a/b/c");
            testSession.save();
        } finally {
            superuser.refresh(false);
            superuser.getNode(UserConstants.DEFAULT_GROUP_PATH + "/a").remove();
            JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(acMgr, UserConstants.DEFAULT_GROUP_PATH);
View Full Code Here

                if (!isValid(def, NT_REP_AUTHORIZABLE, false)) {
                    return false;
                }

                String principalName = propInfo.getTextValue().getString();
                Principal principal = new PrincipalImpl(principalName);
                userManager.checkValidPrincipal(principal, a.isGroup());
                userManager.setPrincipal(parent, principal);

            /*
             Remember principal of new user/group for further processing
View Full Code Here

            }
            List<String> nonExisting = new ArrayList<String>();
            for (String principalName : toAdd) {
                Principal principal = (principals.containsKey(principalName)) ?
                        principals.get(principalName) :
                        new PrincipalImpl(principalName);
                if (!imp.grantImpersonation(principal)) {
                    handleFailure("Failed to grant impersonation for " + principalName + " on " + a);
                    if (importBehavior == ImportBehavior.BESTEFFORT &&
                            getPrincipalManager().getPrincipal(principalName) == null) {
                        log.info("ImportBehavior.BESTEFFORT: Remember non-existing impersonator for special processing.");
View Full Code Here

        }

        // make sure the target node for group-import exists
        Authorizable administrators = userMgr.getAuthorizable(ADMINISTRATORS);
        if (userMgr.getAuthorizable(ADMINISTRATORS) == null) {
            userMgr.createGroup(new PrincipalImpl(ADMINISTRATORS));
        } else if (!administrators.isGroup()) {
            throw new NotExecutableException("Expected " + administrators.getID() + " to be a group.");
        }
        adminSession.save();
    }
View Full Code Here

    private Principal getPrincipal(@Nonnull Tree aceTree) {
        String principalName = checkNotNull(TreeUtil.getString(aceTree, REP_PRINCIPAL_NAME));
        Principal principal = principalManager.getPrincipal(principalName);
        if (principal == null) {
            log.debug("Unknown principal " + principalName);
            principal = new PrincipalImpl(principalName);
        }
        return principal;
    }
View Full Code Here

        return getQueryManager().findAuthorizables(query);
    }

    @Override
    public User createUser(final String userID, String password) throws RepositoryException {
        Principal principal = new PrincipalImpl(userID);
        return createUser(userID, password, principal, null);
    }
View Full Code Here

    }

    @Override
    public User createSystemUser(String userID, String intermediatePath) throws AuthorizableExistsException, RepositoryException {
        checkValidID(userID);
        Principal principal = new PrincipalImpl(userID);
        checkValidPrincipal(principal, false);

        Tree userTree = userProvider.createSystemUser(userID, intermediatePath);
        setPrincipal(userTree, principal);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl

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.