Package org.apache.jetspeed.sso

Examples of org.apache.jetspeed.sso.SSOSite


    }
    }
   
    public String getRealmForSite(String site) throws SSOException
    {
      SSOSite ssoSite = getSSOSiteObject(site);
   
    if ( ssoSite != null)
    {
      return ssoSite.getRealm();
    }
   
    return null;
    }
View Full Code Here


    /**
     * getSiteName
     */
    public String getSiteName(String site)
    {
        SSOSite ssoSite = getSSOSiteObject(site);
   
    if ( ssoSite != null)
    {
      return ssoSite.getName();
    }
    else
    {
        return null;
    }
View Full Code Here

  /* (non-Javadoc)
   * @see org.apache.jetspeed.sso.SSOProvider#hasSSOCredentials(javax.security.auth.Subject, java.lang.String)
   */
  public boolean hasSSOCredentials(Subject subject, String site) {
    // Initialization
    SSOSite ssoSite = getSSOSiteObject(site);
   
    if ( ssoSite == null)
    {
      return false// no entry for site
    }
   
    // Get the principal from the subject
    BasePrincipal principal = (BasePrincipal)SecurityHelper.getBestPrincipal(subject, UserPrincipal.class);
    String fullPath = principal.getFullPath();
   
       
    // Get remotePrincipals for Site and match them with the Remote Principal for the Principal attached to site
    Collection remoteForSite    = ssoSite.getRemotePrincipals();
    Collection principalsForSite  = ssoSite.getPrincipals()// Users
   
    // If any of them don't exist just return
    if (principalsForSite == null || remoteForSite== null )
        return false// no entry
   
View Full Code Here

   */
  public SSOContext getCredentials(Subject subject, String site)
      throws SSOException {
   
    // 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
View Full Code Here

   * @see org.apache.jetspeed.sso.SSOProvider#addCredentialsForSite(javax.security.auth.Subject, java.lang.String, java.lang.String)
   */
  public void addCredentialsForSite(Subject subject, String remoteUser, String site, String pwd) throws SSOException
  {
    // Check if an entry for the site already exists otherwise create a new one
    SSOSite ssoSite = getSSOSiteObject(site);
    if (ssoSite == null)
    {
      // Create a new site
      ssoSite = new SSOSiteImpl();
      ssoSite.setSiteURL(site);
      ssoSite.setName(site);
      ssoSite.setCertificateRequired(false);
      ssoSite.setAllowUserSet(true);
      // By default we use ChallengeResponse Authentication
      ssoSite.setChallengeResponseAuthentication(true);
      ssoSite.setFormAuthentication(false);
     
      // Store the site so that we get a valid SSOSiteID
          updateSite(ssoSite);
    }
   
View Full Code Here

      throws SSOException {
   
    // Initailization
    InternalUserPrincipal remotePrincipal = null;
    //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);
     
      if (remoteForPrincipals.remove(remotePrincipal) == true)
     
      // Update the site
      getPersistenceBrokerTemplate().store(ssoSite);
View Full Code Here

      // Update the credential
      //     Initailization
      InternalUserPrincipal remotePrincipal = null;
     
      //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();
     
      //  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);
     
View Full Code Here

   */
 
  private SSOSite getSSOSiteObject(String site)
  {
    //Initialization
    SSOSite ssoSite = null;
   
    //Check if the site is in the map
    if (mapSite.containsKey(site) == false )
    {
      //  Go to the database and fetch the information for this site
View Full Code Here

    public SSOSite getSite(String siteUrl)
    {
        Criteria filter = new Criteria();
        filter.addEqualTo("siteURL", siteUrl);
        Query query = QueryFactory.newQuery(SSOSiteImpl.class, filter);
        SSOSite site = (SSOSite) getPersistenceBrokerTemplate().getObjectByQuery(query);
        if (site != null)
        {   
            this.mapSite.put(siteUrl, site);
        }
        else
View Full Code Here

    public void addSiteFormAuthenticated(String siteName, String siteUrl, String realm, String userField, String pwdField)
    throws SSOException
    {
      try
        {
            SSOSite ssoSite = new SSOSiteImpl();
            ssoSite.setSiteURL(siteUrl);
            ssoSite.setName(siteName);
            ssoSite.setCertificateRequired(false);
            ssoSite.setAllowUserSet(true);
            ssoSite.setRealm(realm);
            ssoSite.setFormAuthentication(true);
            ssoSite.setFormUserField(userField);
            ssoSite.setFormPwdField(pwdField);
            getPersistenceBrokerTemplate().store(ssoSite);
            this.mapSite.put(siteUrl, ssoSite);           
        }
        catch (Exception e)
        {
View Full Code Here

TOP

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

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.