Package org.apache.jetspeed.security

Examples of org.apache.jetspeed.security.SecurityException


            return getFirstDnForUid(searchResults);
        }
        catch (NamingException e)
        {
            throw new SecurityException(e);
        }
    }
View Full Code Here


        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

            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
        {
            throw new SecurityException(SecurityException.USER_DOES_NOT_EXIST.create(username));
        }
    }
View Full Code Here

            isMappingOnly = true;
            internalGroup = new InternalGroupPrincipalImpl(groupFullPathName);
        }               
        if (null == internalGroup)
        {
            throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(internalGroup));
        }
        Collection internalRoles = internalGroup.getRolePrincipals();
        InternalRolePrincipal internalRole = commonQueries.getInternalRolePrincipal(RolePrincipalImpl
                .getFullPathFromPrincipalName(roleFullPathName));
        internalRoles.remove(internalRole);
View Full Code Here

        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

            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
        {
            throw new SecurityException(SecurityException.USER_DOES_NOT_EXIST.create(username));
        }
    }
View Full Code Here

        {
            setPassword(userDn, password);
        }
        catch (NamingException e)
        {
            throw new SecurityException(e);
        }
    }
View Full Code Here

      String oldCredential = (String)env.get(Context.SECURITY_CREDENTIALS);
      String oldUsername = (String)env.get(Context.SECURITY_PRINCIPAL);
           
      String dn = lookupByUid(uid);
            if ( dn == null )
        throw new SecurityException(new KeyedMessage("User " + uid + " not found"));
           
            // Build user dn using lookup value, just appending the user filter after the uid won't work when users
            // are/can be stored in a subtree (searchScope sub-tree)
            // The looked up dn though is/should always be correct, just need to append the root context.
            if (!StringUtils.isEmpty(getRootContext()))
                dn +="," + getRootContext();
     
      env.put(Context.SECURITY_PRINCIPAL,dn);
      env.put(Context.SECURITY_CREDENTIALS,password);
      new InitialContext(env);
      env.put(Context.SECURITY_PRINCIPAL,oldUsername);
      env.put(Context.SECURITY_CREDENTIALS,oldCredential);
      return true;
    }
    catch (AuthenticationException e)
    {
      return false;
    }
    catch (NamingException e)
    {
      throw new SecurityException(e);
    }
    }
View Full Code Here

            return getPassword(results, uid);
        }
        catch (NamingException e)
        {
            throw new SecurityException(e);
        }
    }
View Full Code Here

        { 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

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.