Package org.apache.jetspeed.security.om

Examples of org.apache.jetspeed.security.om.InternalUserPrincipal


     * @see org.apache.jetspeed.security.spi.SecurityMappingHandler#getRolePrincipals(java.lang.String)
     */
    public Set getRolePrincipals(String username)
    {
        Set rolePrincipals = new HashSet();
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username);
        if (null != internalUser)
        {
            Collection internalRoles = internalUser.getRolePrincipals();
            if (null != internalRoles)
            {
                Iterator internalRolesIter = internalRoles.iterator();
                while (internalRolesIter.hasNext())
                {
View Full Code Here


     * @see org.apache.jetspeed.security.spi.SecurityMappingHandler#setUserPrincipalInRole(java.lang.String,
     *      java.lang.String)
     */
    public void setUserPrincipalInRole(String username, String roleFullPathName) throws SecurityException
    {
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username);
        boolean isMappingOnly = false;
        if (null == internalUser)
        {
            // This is a record for mapping only.
            isMappingOnly = true;
            internalUser = new InternalUserPrincipalImpl(UserPrincipalImpl.getFullPathFromPrincipalName(username));
        }
        Collection internalRoles = internalUser.getRolePrincipals();
        // This should not be null. Check for null should be made by the caller.
        InternalRolePrincipal internalRole = commonQueries.getInternalRolePrincipal(RolePrincipalImpl
                .getFullPathFromPrincipalName(roleFullPathName));
        // Check anyway.
        if (null == internalRole)
        {
            throw new SecurityException(SecurityException.ROLE_DOES_NOT_EXIST.create(roleFullPathName));
        }
        internalRoles.add(internalRole);
        internalUser.setRolePrincipals(internalRoles);
        commonQueries.setInternalUserPrincipal(internalUser, isMappingOnly);
    }
View Full Code Here

     */
    public void removeUserPrincipalInRole(String username, String roleFullPathName) throws SecurityException
    {
        boolean isMappingOnly = false;
        // Check is the record is used for mapping only.
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username, false);
        if (null == internalUser)
        {
            internalUser = commonQueries.getInternalUserPrincipal(username, true);
            isMappingOnly = true;
        }
        if (null != internalUser)
        {
            Collection internalRoles = internalUser.getRolePrincipals();
            // This should not be null. Check for null should be made by the caller.
            InternalRolePrincipal internalRole = commonQueries.getInternalRolePrincipal(RolePrincipalImpl
                    .getFullPathFromPrincipalName(roleFullPathName));
            // Check anyway.
            if (null == internalRole)
            {
                throw new SecurityException(SecurityException.ROLE_DOES_NOT_EXIST.create(roleFullPathName));
            }
            internalRoles.remove(internalRole);
            // Remove dead mapping records. I.e. No mapping is associated with the specific record.
            if (isMappingOnly && internalRoles.isEmpty() && internalUser.getGroupPrincipals().isEmpty()
                    && internalUser.getPermissions().isEmpty())
            {
                commonQueries.removeInternalUserPrincipal(internalUser);
            }
            else
            {
                internalUser.setRolePrincipals(internalRoles);
                commonQueries.setInternalUserPrincipal(internalUser, isMappingOnly);
            }
        }
        else
        {
View Full Code Here

     * @see org.apache.jetspeed.security.spi.SecurityMappingHandler#getGroupPrincipals(java.lang.String)
     */
    public Set getGroupPrincipals(String username)
    {
        Set groupPrincipals = new HashSet();
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username);
        if (null != internalUser)
        {
            Collection internalGroups = internalUser.getGroupPrincipals();
            if (null != internalGroups)
            {
                Iterator internalGroupsIter = internalGroups.iterator();
                while (internalGroupsIter.hasNext())
                {
View Full Code Here

                if (null != internalUsers)
                {
                    Iterator internalUsersIter = internalUsers.iterator();
                    while (internalUsersIter.hasNext())
                    {
                        InternalUserPrincipal internalUser = (InternalUserPrincipal) internalUsersIter.next();
                        Principal userPrincipal = new UserPrincipalImpl(UserPrincipalImpl
                                .getPrincipalNameFromFullPath(internalUser.getFullPath()));
                        if (!userPrincipals.contains(userPrincipal))
                        {
                            userPrincipals.add(userPrincipal);
                        }
                    }
View Full Code Here

                if (null != internalUsers)
                {
                    Iterator internalUsersIter = internalUsers.iterator();
                    while (internalUsersIter.hasNext())
                    {
                        InternalUserPrincipal internalUser = (InternalUserPrincipal) internalUsersIter.next();
                        Principal userPrincipal = new UserPrincipalImpl(UserPrincipalImpl
                                .getPrincipalNameFromFullPath(internalUser.getFullPath()));
                        if (!userPrincipals.contains(userPrincipal))
                        {
                            userPrincipals.add(userPrincipal);
                        }
                    }
View Full Code Here

     * @see org.apache.jetspeed.security.spi.SecurityMappingHandler#setUserPrincipalInGroup(java.lang.String,
     *      java.lang.String)
     */
    public void setUserPrincipalInGroup(String username, String groupFullPathName) throws SecurityException
    {
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username);
        boolean isMappingOnly = false;
        if (null == internalUser)
        {
            // This is a record for mapping only.
            isMappingOnly = true;
            internalUser = new InternalUserPrincipalImpl(UserPrincipalImpl.getFullPathFromPrincipalName(username));
        }
        Collection internalGroups = internalUser.getGroupPrincipals();
        // This should not be null. Check for null should be made by the caller.
        InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(GroupPrincipalImpl
                .getFullPathFromPrincipalName(groupFullPathName));
        // Check anyway.
        if (null == internalGroup)
        {
            throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(groupFullPathName));
        }
        internalGroups.add(internalGroup);
        internalUser.setGroupPrincipals(internalGroups);
        commonQueries.setInternalUserPrincipal(internalUser, isMappingOnly);
    }
View Full Code Here

     */
    public void removeUserPrincipalInGroup(String username, String groupFullPathName) throws SecurityException
    {
        boolean isMappingOnly = false;
        // Check is the record is used for mapping only.
        InternalUserPrincipal internalUser = commonQueries.getInternalUserPrincipal(username, false);
        if (null == internalUser)
        {
            internalUser = commonQueries.getInternalUserPrincipal(username, true);
            isMappingOnly = true;
        }
        if (null != internalUser)
        {
            Collection internalGroups = internalUser.getGroupPrincipals();
            // This should not be null. Check for null should be made by the caller.
            InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(GroupPrincipalImpl
                    .getFullPathFromPrincipalName(groupFullPathName));
            // Check anyway.
            if (null == internalGroup)
            {
                throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(groupFullPathName));
            }
            internalGroups.remove(internalGroup);
            // Remove dead mapping records. I.e. No mapping is associated with the specific record.
            if (isMappingOnly && internalGroups.isEmpty() && internalUser.getRolePrincipals().isEmpty()
                    && internalUser.getPermissions().isEmpty())
            {
                commonQueries.removeInternalUserPrincipal(internalUser);
            }
            else
            {
            internalUser.setGroupPrincipals(internalGroups);
            commonQueries.setInternalUserPrincipal(internalUser, isMappingOnly);
            }
        }
        else
        {
View Full Code Here

        site.setFormPwdField(s.getFormPwdField());

        Iterator rupIter = s.getRemotePrincipals().iterator();
        while (rupIter.hasNext())
        {
            InternalUserPrincipal rup = (InternalUserPrincipal)rupIter.next();
            InternalCredential rupCredential = null;
            Collection rupCredentials = rup.getCredentials();
            if (rupCredentials != null)
            {
                rupCredential = (InternalCredential)rupCredentials.iterator().next();
            }
            if (rupCredential != null)
            {
                String rupPath = rup.getFullPath();
                String rupPrincipalType = null;
                String rupPrincipalName = null;
                String rupName = null;
                String [] names = null;
                if (rupPath.startsWith("/sso/") && (rupPath.indexOf("/user/") != -1))
View Full Code Here

      Vector temp = new Vector();
     
      Iterator itRemotePrincipal = ssoPrincipal.getRemotePrincipals().iterator();
      while (itRemotePrincipal.hasNext())
      {
        InternalUserPrincipal rp  = (InternalUserPrincipal)itRemotePrincipal.next();
        if (rp != null)
        {
          temp.add(rp.getFullPath());
        }
      }
     
      if (temp.size() > 0)
      {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.om.InternalUserPrincipal

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.