Package org.apache.jetspeed.sso

Examples of org.apache.jetspeed.sso.SSOException


            //bStatus = true;
          }
          catch(Exception e)
          {
            // Adding credentail to coollection failed -- notify caller with SSOException
            throw new SSOException(SSOException.FAILED_REMOVING_PRINCIPAL_FROM_MAPPING_TABLE_FOR_SITE + e.getMessage());
          }
         
          if ( bStatus == false)
            throw new SSOException(SSOException.FAILED_REMOVING_PRINCIPAL_FROM_MAPPING_TABLE_FOR_SITE );
        }
         
      }
    }
View Full Code Here


   
    // Initialization
    SSOSite ssoSite = getSSOSiteObject(site);
   
    if ( ssoSite == null)
      throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE)// no entry for site
   
    // Get the principal from the subject
    BasePrincipal principal = (BasePrincipal)SecurityHelper.getBestPrincipal(subject, UserPrincipal.class);
    String fullPath = principal.getFullPath();
   
    // Filter the credentials for the given principals
    SSOContext context = getCredential(ssoSite, fullPath)
   
    if ( context == null)
      throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE)// no entry for site
   
    return context;
  }
View Full Code Here

        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
     try
         {
             getPersistenceBrokerTemplate().store(ssoSite);
          }
         catch (Exception e)
         {
           e.printStackTrace();
            throw new SSOException(SSOException.FAILED_STORING_SITE_INFO_IN_DB + e.toString() );
         }
         // Add to site
         this.mapSite.put(site, ssoSite);
         // Clear cache
         //this.mapSite.clear();
View Full Code Here

   
    //Get the site
    SSOSite ssoSite = getSSOSiteObject(site);
    if (ssoSite == null)
    {
      throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
    }
   
    // Get the Principal information
    String fullPath = ((BasePrincipal)SecurityHelper.getBestPrincipal(subject, UserPrincipal.class)).getFullPath();
   
    try
    {
      //  Get remotePrincipals for Site and match them with the Remote Principal for the Principal attached to site
      Collection principalsForSite = ssoSite.getPrincipals();
      Collection remoteForSite = ssoSite.getRemotePrincipals();
     
      // If any of them don't exist just return
      if (principalsForSite == null || remoteForSite== null )
          throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
     
      Collection remoteForPrincipals = getRemotePrincipalsForPrincipal(principalsForSite, fullPath);
     
      if ( remoteForPrincipals == null)
          throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
     
      // Get remote Principal that matches the site and the principal
      if ((remotePrincipal = FindRemoteMatch(remoteForPrincipals, remoteForSite)) == null )
      {
          throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
      }
     
      // Update assocation tables
      ssoSite.getRemotePrincipals().remove(remotePrincipal);
      getRemotePrincipalsForPrincipal(principalsForSite, fullPath).remove(remotePrincipal);
       
      // delete the remote Principal from the SECURITY_PRINCIPAL table
        getPersistenceBrokerTemplate().delete(remotePrincipal);
     
    }
    catch(SSOException ssoex)
    {
      throw new SSOException(ssoex);
    }
    catch (Exception e)
        {
          e.printStackTrace();
           throw new SSOException(SSOException.FAILED_STORING_SITE_INFO_IN_DB + e.toString() );
        }
               
    // Update database
     try
         {
             getPersistenceBrokerTemplate().store(ssoSite);
          }
         catch (Exception e)
         {
           e.printStackTrace();
            throw new SSOException(SSOException.FAILED_STORING_SITE_INFO_IN_DB + e.toString() );
         }
        
         // Clear cache
       //  this.mapSite.clear();
  }
View Full Code Here

     
      //Get the site
      SSOSite ssoSite = getSSOSiteObject(site);
      if (ssoSite == null)
      {
        throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
      }
     
      // Get the Principal information
      String fullPath = ((BasePrincipal)SecurityHelper.getBestPrincipal(subject, UserPrincipal.class)).getFullPath();
      String principalName  = ((BasePrincipal)SecurityHelper.getBestPrincipal(subject, UserPrincipal.class)).getName();
     
      //  Get remotePrincipals for Site and match them with the Remote Principal for the Principal attached to site
      Collection principalsForSite = ssoSite.getPrincipals();
      Collection remoteForSite = ssoSite.getRemotePrincipals();
     
      // If any of them don't exist just return
      if (principalsForSite == null || remoteForSite== null )
          throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
     
      Collection remoteForPrincipals = getRemotePrincipalsForPrincipal(principalsForSite, fullPath);
     
      if ( remoteForPrincipals == null)
          throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
     
      // Get remote Principal that matches the site and the principal
      if ((remotePrincipal = FindRemoteMatch(remoteForPrincipals, remoteForSite)) == null )
      {
          throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE);
      }
           
      // Update principal information
      remotePrincipal.setFullPath("/sso/user/"+ principalName + "/" + remoteUser);
      InternalCredential credential = (InternalCredential)remotePrincipal.getCredentials().iterator().next();
         
      // New credential object
       if ( credential != null)
        // Remove credential and principal from mapping
         credential.setValue(pwd);
     
      // Update database and reset cache
       try
       {
           getPersistenceBrokerTemplate().store(ssoSite);
        }
       catch (Exception e)
       {
         e.printStackTrace();
          throw new SSOException(SSOException.FAILED_STORING_SITE_INFO_IN_DB + e.toString() );
       }      
      }
View Full Code Here

          }
        }
      }
    }   
   
    throw new SSOException(SSOException.REQUESTED_PRINCIPAL_DOES_NOT_EXIST);
  }
View Full Code Here

                // SSO API lookup
                SSOContext credentials = null;
                try
                {
                    if (sso == null)
                        throw new SSOException("SSO Not supported.");
                   
                    credentials = sso.getCredentials(getSubject(), ssoURL);
                }
                catch(SSOException ssoex)
                {
View Full Code Here

     
      if (sites == null)
      {
        String msg = "SSO Component useSSO -- Couldn't find any SSO sites for user ["+fullPath+"]";
        log.error(msg);
        throw new SSOException(msg);
      }
     
      // Load all the sites
      int siteSize = sites.size();
      int siteIndex =0;
View Full Code Here

        ssoSite.setRealm(realm);
        getPersistenceBrokerTemplate().store(ssoSite);
      }
      catch (Exception e)
      {
        throw new SSOException("Failed to set the realm for site [" + site + "] Error" +e );
      }
    }
    }
View Full Code Here

   
    // Initialization
    SSOSite ssoSite = getSSOSiteObject(site);
   
    if ( ssoSite == null)
      throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE)// no entry for site
   
    // Get the principal from the subject
    BasePrincipal principal = (BasePrincipal)SecurityHelper.getBestPrincipal(subject, UserPrincipal.class);
    String fullPath = principal.getFullPath();
   
    // Filter the credentials for the given principals
    SSOContext context = getCredential(ssoSite, fullPath)
   
    if ( context == null)
      throw new SSOException(SSOException.NO_CREDENTIALS_FOR_SITE)// no entry for site
   
    return context;
  }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.sso.SSOException

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.