Package org.apache.jetspeed.security

Examples of org.apache.jetspeed.security.SecurityException


        { groupFullPathName}, new String[]
        { "groupFullPathName"}, "addGroup(java.lang.String)");

        // Check if group already exists.
        if (groupExists(groupFullPathName)) { 
            throw new SecurityException(SecurityException.GROUP_ALREADY_EXISTS.create(groupFullPathName));
        }

        GroupPrincipal groupPrincipal = new GroupPrincipalImpl(
                groupFullPathName);
        String fullPath = groupPrincipal.getFullPath();
View Full Code Here


                    SecurityException.UNEXPECTED.create("GroupManager.removeGroup",
                                                        "GroupSecurityHandler.removeGroupPrincipal("+
                        GroupPrincipalImpl.getPrincipalNameFromFullPath((String) groups[i])+")",
                        e.getMessage());
                log.error(msg, e);
                throw new SecurityException(msg, e);
            }
            // Remove preferences
            Preferences groupPref = Preferences.userRoot().node(
                    (String) groups[i]);
            try
            {
                groupPref.removeNode();
            } catch (BackingStoreException bse)
            {
                KeyedMessage msg =
                    SecurityException.UNEXPECTED.create("Preferences.removeNode("+groups[i]+")",
                                                        bse.getMessage());
                log.error(msg, bse);
                throw new SecurityException(msg, bse);
            }
        }
    }
View Full Code Here

                .getFullPathFromPrincipalName(groupFullPathName);

        Principal groupPrincipal = groupSecurityHandler
                .getGroupPrincipal(groupFullPathName);
        if (null == groupPrincipal) {
            throw new SecurityException(
                SecurityException.GROUP_DOES_NOT_EXIST.create(groupFullPathName));
        }
        Preferences preferences = Preferences.userRoot().node(fullPath);
        Group group = new GroupImpl(groupPrincipal, preferences);
        return group;
View Full Code Here

        // Get the group principal to add to user.
        Principal groupPrincipal = groupSecurityHandler
                .getGroupPrincipal(groupFullPathName);
        if (null == groupPrincipal) {
            throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(groupFullPathName));
        }
        // Check that user exists.
        Principal userPrincipal = atnProviderProxy.getUserPrincipal(username);
        if (null == userPrincipal) {
            throw new SecurityException(SecurityException.USER_DOES_NOT_EXIST.create(username));
        }
        // Get the user groups.
        Set groupPrincipals = securityMappingHandler
                .getGroupPrincipals(username);
        // Add group to user.
View Full Code Here

                "removeUserFromGroup(java.lang.String, java.lang.String)");

        // Check that user exists.
        Principal userPrincipal = atnProviderProxy.getUserPrincipal(username);
        if (null == userPrincipal) {
            throw new SecurityException(SecurityException.USER_DOES_NOT_EXIST.create(username));
        }
        // Get the group principal to remove.
        Principal groupPrincipal = groupSecurityHandler
                .getGroupPrincipal(groupFullPathName);
        if (null != groupPrincipal)
View Full Code Here

            {
                synchronizeEntity(userEntity, new HashMap<String,Set<String>>(), new HashMap<String,Map<String,String>>());
            }
            else
            {
                throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.USER, name));
            }
        }
        finally
        {
            setSynchronizing(false);
View Full Code Here

        JetspeedPrincipalManager principalManager = principalManagerProvider.getManager(principalManagerProvider.getPrincipalType(principalType));
        if (principalManager != null)
        {
            return principalManager.getPrincipal(principalName);
        }
        throw new SecurityException(SecurityException.UNKNOWN_PRINCIPAL_TYPE.create(principalType));
    }
View Full Code Here

        query.setJdbcTypes(new int[]{Types.BIGINT});
        for (Iterator<Object[]> iter = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query); iter.hasNext(); )
        {
            return (Long)iter.next()[0];
        }
        throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(type, name));
    }
View Full Code Here

        if (principal.getDomainId() == null && principal instanceof TransientJetspeedPrincipal){
            ((TransientJetspeedPrincipal)principal).setDomainId(getDefaultSecurityDomainId());
        }
        if (principalExists(principal))
        {
            throw new SecurityException(SecurityException.PRINCIPAL_ALREADY_EXISTS.createScoped(principal.getType().getName(), principal.getName()));
        }
        try
        {
            getPersistenceBrokerTemplate().store(principal);
        }
        catch (Exception pbe)
        {
            KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
                                                                   "addPrincipal",
                                                                   pbe.getMessage());
            logger.error(msg, pbe);
            throw new SecurityException(msg, pbe);           
        }
        // Note: the (optional) required associations are expected to be stored by the calling JetspeedPrincipalManager
    }
View Full Code Here

    public void removePrincipal(JetspeedPrincipal principal) throws SecurityException
   
    {
        if (!principalExists(principal))
        {
            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(principal.getType().getName(), principal.getName()));
        }
        try
        {
            getPersistenceBrokerTemplate().delete(principal);
        }
        catch (Exception pbe)
        {
            if (pbe instanceof DataIntegrityViolationException)
            {
                logger.error(pbe.getMessage(), pbe);
                throw new SecurityException(SecurityException.PRINCIPAL_NOT_REMOVABLE.createScoped(principal.getType().getName(), principal.getName()));
            }
           
            KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
                                                                   "removePrincipal",
                                                                   pbe.getMessage());
            logger.error(msg, pbe);
            throw new SecurityException(msg, pbe);           
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.SecurityException

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.