Package org.apache.jetspeed.sso

Examples of org.apache.jetspeed.sso.SSOSite


    }

    public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
    {
        String siteUrl = request.getPreferences().getValue("SRC", null);
        SSOSite site = null;
        if (siteUrl != null)
        {
            site = sso.getSiteByUrl(siteUrl);
        }
        if (site == null)
View Full Code Here


        if (ssoPrincipal == null || ssoCredential == null)
        {
            actionResponse.setPortletMode(PortletMode.EDIT); // stay on edit
        }
        String siteUrl = request.getPreferences().getValue("SRC", "");
        SSOSite site = sso.getSiteByUrl(siteUrl);
        try
        {
            if (!SecurityHelper.isEmpty(siteUrl) && !SecurityHelper.isEmpty(ssoPrincipal) && !SecurityHelper.isEmpty(ssoCredential))
            {
                if (site == null)
View Full Code Here

    }

    public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException
    {
        String siteUrl = request.getPreferences().getValue("SRC", "");
        SSOSite site = sso.getSiteByUrl(siteUrl);
        if (site != null)
        {
            try
            {
                SSOUser remoteUser = SSOPortletUtil.getRemoteUser(sso, request, site);
View Full Code Here

    }

    public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
    {
        String siteUrl = request.getPreferences().getValue("SRC", null);
        SSOSite site = null;
        if (siteUrl != null)
        {
            site = sso.getSiteByUrl(siteUrl);
        }
        if (site == null)
View Full Code Here

        if (ssoPrincipal == null || ssoCredential == null)
        {
            actionResponse.setPortletMode(PortletMode.EDIT); // stay on edit
        }
        String siteUrl = request.getPreferences().getValue("SRC", "");
        SSOSite site = sso.getSiteByUrl(siteUrl);
        try
        {
            if (!SecurityHelper.isEmpty(siteUrl) && !SecurityHelper.isEmpty(ssoPrincipal) && !SecurityHelper.isEmpty(ssoCredential))
            {
                if (site == null)
View Full Code Here

        {
            // processPreferencesAction(request, actionResponse);
            // get the POST params -- requires HTML post params named above
            String siteUrl = actionRequest.getPreferences().getValue("SRC", "");
            String localUser = actionRequest.getUserPrincipal().getName();
            SSOSite site = sso.getSiteByUrl(siteUrl);
            try
            {       
                if (!SecurityHelper.isEmpty(siteUrl) && !SecurityHelper.isEmpty(ssoPrincipalName) && !SecurityHelper.isEmpty(ssoPrincipalPassword))
                {
                    if (site == 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 principalsForSite = ssoSite.getPrincipals();
    Collection remoteForSite = ssoSite.getRemotePrincipals();
   
    // 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

   */
  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);
    }
   
    // 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
     try
         {
             getPersistenceBrokerTemplate().store(ssoSite);
View Full Code Here

    // Initailization
    InternalUserPrincipal remotePrincipal = null;
    SSOPrincipal principal = 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);
      getRemotePrincipalsForPrincipal(principalsForSite, fullPath).remove(remotePrincipal);
       
      // delete the remote Principal from the SECURITY_PRINCIPAL table
        getPersistenceBrokerTemplate().delete(remotePrincipal);
     
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.