Examples of SSOPrincipal


Examples of org.apache.jetspeed.sso.SSOPrincipal

      return null// No principals for this site
   
    Iterator ixPrincipals = principals.iterator();
    while (ixPrincipals.hasNext())
    {
      SSOPrincipal principal = (SSOPrincipal)ixPrincipals.next();
      if (         principal != null
              && principal.getFullPath().compareToIgnoreCase(fullPath) == 0 )
      {
        // Found Principal -- extract remote principals
        return principal.getRemotePrincipals();
      }
    }
   
    // Principal is not in list
    return null;
View Full Code Here

Examples of org.apache.jetspeed.sso.SSOPrincipal

   * getPrincipalForSite()
   * returns a principal that matches the full path for the site or creates a new entry if it doesn't exist
   */
  private SSOPrincipal getPrincipalForSite(SSOSite ssoSite, String fullPath)
  {
    SSOPrincipal principal = null;
    Collection principalsForSite = ssoSite.getPrincipals();
   
    if ( principalsForSite != null)
    {
      Iterator itPrincipals = principalsForSite.iterator();
      while (itPrincipals.hasNext() && principal == null)
      {
        SSOPrincipal tmp  = (SSOPrincipal)itPrincipals.next();
        if (      tmp != null
               && tmp.getFullPath().compareToIgnoreCase(fullPath) == 0 )
          principal = tmp;  // Found existing entry
      }
    }
   
    return principal;
View Full Code Here

Examples of org.apache.jetspeed.sso.SSOPrincipal

  }
 
  private SSOPrincipal getSSOPrincipal(String fullPath)
  {
      // FInd if the principal exists in the SECURITY_PRINCIPAL table
      SSOPrincipal principal = null;
     
    Criteria filter = new Criteria();      
      filter.addEqualTo("fullPath", fullPath);
     
      QueryByCriteria query = QueryFactory.newQuery(SSOPrincipalImpl.class, filter);
View Full Code Here

Examples of org.apache.jetspeed.sso.SSOPrincipal

    if (site.getPrincipals() != null)
    {
      Iterator itPrincipals = site.getPrincipals().iterator();
      while (itPrincipals.hasNext())
      {
        SSOPrincipal tmp = (SSOPrincipal)itPrincipals.next();
        if (tmp.getFullPath().compareToIgnoreCase(fullPath) == 0)
        {
          // Found -- get the remotePrincipal
          Collection collRemotePrincipals = tmp.getRemotePrincipals() ;
          if (collRemotePrincipals != null)
          {
         
            Iterator itRemotePrincipals = collRemotePrincipals.iterator();
            if  (itRemotePrincipals.hasNext())
View Full Code Here

Examples of org.apache.jetspeed.sso.SSOPrincipal

      {
        Iterator itPrincipalsForSite = principalsForSite.iterator();
        while (itPrincipalsForSite.hasNext())
        {
            String principalFullPath = null;
            SSOPrincipal principal = (SSOPrincipal)itPrincipalsForSite.next();
            principalFullPath = principal.getFullPath();
           
            /* If the Principal is for a Group expand the Group and check if the user identified
            * by the fullPath is a member of the Group. If the user is a member of the Group
            * return the remote Credentials for the current Principal.
            */
            if ( principalFullPath.indexOf("/group/") == -1)
            {
                // USER
                if ( principalFullPath.compareToIgnoreCase(fullPath) == 0)
                    return principal.getRemotePrincipals();
            }
            else
            {
                /* GROUP
                 * If the full path is for a group (delete/add) just return the the list of remotePrincipals
                 * For a lookup (hasCredentials) the user needs to be mapped against each member of the group
                */
                if ( principalFullPath.compareToIgnoreCase(fullPath) == 0)
                    return principal.getRemotePrincipals();
               
                /* Expand the Group and find a match */
              InternalGroupPrincipal  groupPrincipal = getGroupPrincipals(principalFullPath);
             
              // Found Group that matches the name
              if (groupPrincipal != null)
                {
                  Collection usersInGroup = groupPrincipal.getUserPrincipals();
                  Iterator itUsers = usersInGroup.iterator();
                    while (itUsers.hasNext())
                    {
                        InternalUserPrincipal user = (InternalUserPrincipal)itUsers.next();
                        if (user.getFullPath().compareToIgnoreCase(fullPath) == 0)
                        {
                            // User is member of the group
                            return principal.getRemotePrincipals();
                        }
                    }
                }
            } 
        }
View Full Code Here

Examples of org.apache.jetspeed.sso.SSOPrincipal

     *
     */
    public void removePrincipal(long principalId) throws SSOException
    {
      boolean bStatus = false;
      SSOPrincipal principalObj = null;
      Iterator itSitePrincipals = principals.iterator();
     
      while (itSitePrincipals.hasNext() )
      {
        principalObj = (SSOPrincipal)itSitePrincipals.next();
        if ( principalObj.getPrincipalId() == principalId)
        {
       
          try
          {
            bStatus = principals.remove(principalObj);
View Full Code Here

Examples of org.apache.jetspeed.sso.SSOPrincipal

     *
     */
    public void removePrincipal(long principalId) throws SSOException
    {
      boolean bStatus = false;
      SSOPrincipal principalObj = null;
      Iterator itSitePrincipals = principals.iterator();
     
      while (itSitePrincipals.hasNext() )
      {
        principalObj = (SSOPrincipal)itSitePrincipals.next();
        if ( principalObj.getPrincipalId() == principalId)
        {
       
          try
          {
            // TODO: Removing results in an OJB exception. Ignore it for the moment but it needs to be fixed soon...
View Full Code Here

Examples of org.apache.jetspeed.sso.SSOPrincipal

    // Get the Principal information (logged in user)
    String fullPath = ((BasePrincipal)SecurityHelper.getBestPrincipal(subject, UserPrincipal.class)).getFullPath();
    String principalName = ((BasePrincipal)SecurityHelper.getBestPrincipal(subject, UserPrincipal.class)).getName();
   
    // Add an entry for the principal to the site if it doesn't exist
    SSOPrincipal principal = this.getPrincipalForSite(ssoSite, fullPath);
   
    if (principal == null )
    {
        principal = getSSOPrincipa(fullPath);
        ssoSite.addPrincipal(principal);
    }
    else
    {
        // Check if the entry the user likes to update exists already
        Collection remoteForSite = ssoSite.getRemotePrincipals();
        if ( remoteForSite != null)
        {
            if (FindRemoteMatch(principal.getRemotePrincipals(), remoteForSite) != null )
            {
                // Entry exists can't to an add has to call update
                throw new SSOException(SSOException.REMOTE_PRINCIPAL_EXISTS_CALL_UPDATE);
            }
        }
    }
   
    if (principal == null)
      throw new SSOException(SSOException.FAILED_ADDING_PRINCIPAL_TO_MAPPING_TABLE_FOR_SITE);
   
    // Create a remote principal and credentials
    InternalUserPrincipalImpl remotePrincipal = new InternalUserPrincipalImpl(remoteUser);
    remotePrincipal.setFullPath("/sso/user/"+ principalName + "/" + remoteUser);
 
    // New credential object for remote principal
     InternalCredentialImpl credential =
            new InternalCredentialImpl(remotePrincipal.getPrincipalId(),
                pwd, 0, DefaultPasswordCredentialImpl.class.getName());
    
     if ( remotePrincipal.getCredentials() == null)
       remotePrincipal.setCredentials(new ArrayList(0));
    
    remotePrincipal.getCredentials().add( credential);
   
    // Add it to Principals remotePrincipals list
    principal.addRemotePrincipal(remotePrincipal);
   
    // Update the site remotePrincipals list
    ssoSite.getRemotePrincipals().add(remotePrincipal);
      
    // Update database and reset cache
View Full Code Here

Examples of org.apache.jetspeed.sso.SSOPrincipal

  public void removeCredentialsForSite(Subject subject, String site)
      throws SSOException {
   
    // Initailization
    InternalUserPrincipal remotePrincipal = null;
    SSOPrincipal principal = null;
   
    //Get the site
    SSOSite ssoSite = getSSOSiteObject(site);
    if (ssoSite == null)
    {
View Full Code Here

Examples of org.apache.jetspeed.sso.SSOPrincipal

      return null// No principals for this site
   
    Iterator ixPrincipals = principals.iterator();
    while (ixPrincipals.hasNext())
    {
      SSOPrincipal principal = (SSOPrincipal)ixPrincipals.next();
      if (         principal != null
              && principal.getFullPath().compareToIgnoreCase(fullPath) == 0
              && principal.getSiteID() == ssoSite.getSiteId())
      {
        // Found Principal -- extract remote principals
        return principal.getRemotePrincipals();
      }
    }
   
    // Principal is not in list
    return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.