Package org.apache.jetspeed.sso

Examples of org.apache.jetspeed.sso.SSOSite


        {
            // 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


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

        if (request.getPortletMode() == PortletMode.VIEW)
        {
            String selectedSite = request.getParameter("ssoSite");
            if (selectedSite != null)
            {
              SSOSite site = sso.getSiteByName(selectedSite);
                if (site != null)
                {
                    setPortletMessage(request, "selectedUrl", site.getURL());
                    setPortletMessage(request, "selectedName", site.getName());
                    setPortletMessage(request, "change", selectedSite);
                    setPortletMessage(request, "ssoUsername", getRemoteUserName(request, site));
                }
            }
            String refresh = request.getParameter("sso.refresh");
            String save = request.getParameter("sso.save");
            String delete = request.getParameter("sso.delete");
           
            if (refresh != null)
            {
                this.clearBrowserIterator(request);
            }
            else if (delete != null)
            {
                String siteName = request.getParameter("site.name");
               
                if (!StringUtils.isEmpty(siteName))
                {
                    SSOSite site = sso.getSiteByName(siteName);
                   
                    if (site != null)
                    {
                        removeRemoteUser(request, site);
                        this.clearBrowserIterator(request);
                        clearPortletMessages(request,response);
                    }
                }
            }
            else if (save != null)
            {
                String siteName = request.getParameter("site.name");
                String siteUrl = request.getParameter("site.url");
                String ssoUsername = request.getParameter("ssoUsername");
                String ssoPassword = request.getParameter("ssoPassword");
                
                if (!StringUtils.isEmpty(siteName) && !StringUtils.isEmpty(siteUrl) && !StringUtils.isEmpty(ssoUsername) && !StringUtils.isEmpty(ssoPassword))
                {
                    SSOSite site = null;
                    String old = (String)PortletMessaging.receive(request, "site", "selectedName");
                    site = sso.getSiteByName(old != null ? old : siteName);
                   
                    addOrUpdateRemoteUser(request, site, ssoUsername, ssoPassword);
                   
View Full Code Here

    {
        List resultSetTitleList = new ArrayList();
        List resultSetTypeList = new ArrayList();
        try
        {
            SSOSite site = null;
           
            List<RemoteAndLocalPrincipalPair> list = new ArrayList<RemoteAndLocalPrincipalPair>();

            resultSetTypeList.add(String.valueOf(Types.VARCHAR));
            resultSetTitleList.add("Principal");
View Full Code Here

                    }
                }
              try
                {
                    String siteName = (String)PortletMessaging.receive(request, "site", "selectedName");                                           
                    SSOSite site = sso.getSiteByName(siteName);
                   
                    if ( site != null )
                    {
                       
                      JetspeedPrincipal principal = getJetspeedPrincipal(principalType,principalName);
                      if (principal != null){
                        Collection<SSOUser> ssoUsers = sso.getRemoteUsers(site, principal);
                        if (ssoUsers != null && ssoUsers.size() == 1){
                          sso.removeUser(ssoUsers.iterator().next());
                        } else {
                            // TODO: provide feedback, sso user not found
                          }   
                      } else {
                        // TODO: provide feedback, user not found
                     
                     
                        this.clearBrowserIterator(request);
                   }
                }
                catch (SSOException e)
                {
                    publishStatusMessage(request, "SSODetails", "status", e, "Could not remove credentials");
                }
                catch (SecurityException e)
                {
                    publishStatusMessage(request, "SSODetails", "status", e, "Could not remove credentials");
                }
            }
            else if (add != null)
            {
                // Roger: here is the principal type
                String principalType = request.getParameter("principal.type")//group user
                String portalPrincipal = request.getParameter("portal.principal");               
                String remotePrincipal = request.getParameter("remote.principal");
                String remoteCredential = request.getParameter("remote.credential");
               
                // The principal type can benull if the user just typed the name instead of
                // using the choosers.
               
                if (principalType == null || principalType.length() == 0 )
                    principalType = "user";
               
                if (!(StringUtils.isEmpty(remotePrincipal) || StringUtils.isEmpty(remotePrincipal) || StringUtils.isEmpty(remoteCredential)))
                {
                    try
                    {
                        String siteName = (String)PortletMessaging.receive(request, "site", "selectedName");                       
                        SSOSite site = sso.getSiteByName(siteName);

                        JetspeedPrincipal localPrincipal = getJetspeedPrincipal(principalType, portalPrincipal);
                       
                        if (site != null && localPrincipal != null )
                        {
View Full Code Here

        if (request.getPortletMode() == PortletMode.VIEW)
        {
            String selectedSite = request.getParameter("ssoSite");
            if (selectedSite != null)
            {
              SSOSite site = sso.getSiteByName(selectedSite);
                if (site != null)
                {
                    setPortletMessage(request, "selectedUrl", site.getURL());
                    setPortletMessage(request, "selectedName", site.getName());
                    setPortletMessage(request, "change", selectedSite);
                    setPortletMessage(request, "realm", site.getRealm());
                    setPortletMessage(request, "idField", site.getFormUserField());
                    setPortletMessage(request, "pwdField", site.getFormPwdField());
                }
            }
            String refresh = request.getParameter("sso.refresh");
            String save = request.getParameter("sso.save");
            String neue = request.getParameter("sso.new");
            String delete = request.getParameter("ssoDelete");
           
            if (refresh != null)
            {
                this.clearBrowserIterator(request);
            }
            else if (neue != null)
            {
              clearPortletMessages(request,response);
            }
            else if (delete != null && (!(isEmpty(delete))))
            {
              try
                {
                    SSOSite site = null;
                    site = sso.getSiteByName(delete);
                    if (site != null)
                    {
                        sso.removeSite(site);
                        this.clearBrowserIterator(request);
                        clearPortletMessages(request,response);
                    }
                }
                catch (SSOException e)
                {
                    publishStatusMessage(request, "SSOBrowser", "status", e, "Could not remove site");
                }
             
            }
            else if (save != null)
            {
                String siteName = request.getParameter("site.name");               
                String siteUrl = request.getParameter("site.url");
               
                String siteRealm = request.getParameter("site.realm");               
                String siteFormID = request.getParameter("site.form_field_ID");
                String siteFormPWD = request.getParameter("site.form_field_PWD");
                
                if (!(isEmpty(siteName) || isEmpty(siteUrl)))
                {
                    try
                    {
                        SSOSite site = null;
                        String old = (String)PortletMessaging.receive(request, "site", "selectedName");
                        if (old != null)
                        {
                            site = sso.getSiteByName(old);
                        }
                        else
                        {
                            site = sso.getSiteByName(siteName);
                        }
                        boolean isNewSite = false;
                        if (site == null)
                        {
                          isNewSite = true;
                          site = sso.newSite(siteName, siteUrl);
                        }
                       
                        site.setName(siteName);
                        site.setURL(siteUrl);
                        site.setRealm(siteRealm);
                        site.setFormUserField(siteFormID);
                      site.setFormPwdField(siteFormPWD);
                      site.setFormAuthentication(StringUtils.isNotEmpty(siteFormID) && StringUtils.isNotEmpty(siteFormPWD));
                      site.setChallengeResponseAuthentication(!site.isFormAuthentication());
                     
                      if (isNewSite)
                      {
                        sso.addSite(site);
                      } else
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

    }
   
    public static PasswordCredential getCredentialsForSite(SSOManager sso, String siteUrl, RenderRequest request)
    {
        PasswordCredential pwc = null;
        SSOSite site = sso.getSiteByUrl(siteUrl);
        if (site != null)
        {
            return getCredentialsForSite(sso, site, request);
        }
        return pwc;
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.