portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roger...@apache.org
Subject svn commit: r354643 - in /portals/jetspeed-2/trunk: applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/resources/ applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/sso/ applications/j2-admin/src/webapp/WEB-INF/secur...
Date Wed, 07 Dec 2005 01:25:49 GMT
Author: rogerrut
Date: Tue Dec  6 17:25:37 2005
New Revision: 354643

URL: http://svn.apache.org/viewcvs?rev=354643&view=rev
Log:
Updated Admin portlet for SSO management. Allow to define Realm and fields for Form Authentication

Modified:
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/resources/SSOResources_en.properties
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/sso/sites-view.vm
    portals/jetspeed-2/trunk/components/sso/src/java/org/apache/jetspeed/sso/impl/PersistenceBrokerSSOProvider.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/sso/SSOProvider.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/sso.xml

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/resources/SSOResources_en.properties
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/resources/SSOResources_en.properties?rev=354643&r1=354642&r2=354643&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/resources/SSOResources_en.properties
(original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/resources/SSOResources_en.properties
Tue Dec  6 17:25:37 2005
@@ -30,4 +30,8 @@
 sitename=Site Name:
 siteurl=Site URL:
 confirmtodeletesite=Confirm to Delete Site:
-confirmdelete=Confirm Delete
\ No newline at end of file
+confirmdelete=Confirm Delete
+realm=Site Realm:
+form_authentication_info=Form fields used for From based Authentication. If the fields are
empty Challenge/Response Authentication will be used.
+form_field_id=Field name for User ID:
+form_field_PWD=Field name For Passowrd value:
\ No newline at end of file

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java?rev=354643&r1=354642&r2=354643&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java
(original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java
Tue Dec  6 17:25:37 2005
@@ -115,7 +115,18 @@
             Context context = this.getContext(request);
             context.put("currentUrl", selectedSite);
             String selectedName = (String)PortletMessaging.receive(request, "site", "selectedName");
-            context.put("currentName", selectedName);            
+            context.put("currentName", selectedName);  
+            
+            String realm = (String)PortletMessaging.receive(request, "site", "realm");
+            context.put("currentRealm", realm);  
+            String userField = (String)PortletMessaging.receive(request, "site", "idField");
+            context.put("currentFFID", userField);  
+            String pwdFiled = (String)PortletMessaging.receive(request, "site", "pwdField");
+            context.put("currentFFPWD", pwdFiled);
+
+            
+            
+            
         }
         StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, "SSOBrowser",
"status");
         if (msg != null)
@@ -140,6 +151,9 @@
                     PortletMessaging.publish(request, "site", "selectedUrl", selectedSite);
                     PortletMessaging.publish(request, "site", "selectedName", site.getName());
                     PortletMessaging.publish(request, "site", "change", selectedSite);
+                    PortletMessaging.publish(request, "site", "realm", site.getRealm());
+                    PortletMessaging.publish(request, "site", "idField", site.getFormUserField());
+                    PortletMessaging.publish(request, "site", "pwdField", site.getFormPwdField());
                 }
             }
             String refresh = request.getParameter("sso.refresh");
@@ -154,7 +168,10 @@
             else if (neue != null)
             {
                 PortletMessaging.cancel(request, "site", "selected");
-                PortletMessaging.cancel(request, "site", "selectedUrl");                
               
+                PortletMessaging.cancel(request, "site", "selectedUrl");      
+                PortletMessaging.cancel(request, "site", "realm");
+                PortletMessaging.cancel(request, "site", "idField");
+                PortletMessaging.cancel(request, "site", "pwdField");
             }
             else if (delete != null && (!(isEmpty(delete))))
             {
@@ -167,7 +184,10 @@
                         sso.removeSite(site);
                         this.clearBrowserIterator(request);
                         PortletMessaging.cancel(request, "site", "selected");
-                        PortletMessaging.cancel(request, "site", "selectedUrl");        
                       
+                        PortletMessaging.cancel(request, "site", "selectedUrl");   
+                        PortletMessaging.cancel(request, "site", "realm");
+                        PortletMessaging.cancel(request, "site", "idField");
+                        PortletMessaging.cancel(request, "site", "pwdField");
                     }
                 }
                 catch (SSOException e)
@@ -179,6 +199,11 @@
             {
                 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
@@ -197,14 +222,42 @@
                         {
                             site.setName(siteName);
                             site.setSiteURL(siteUrl);
+                            site.setRealm(siteRealm);
+                            if (siteFormID != null && siteFormID.length() > 0
+                            	&& siteFormPWD != null && siteFormPWD.length()
> 0	)
+                            {
+                            	// Form authentication
+                            	site.setFormAuthentication(true);
+                            	site.setFormUserField(siteFormID);
+                            	site.setFormPwdField(siteFormPWD);
+                            }
+                            else
+                            {
+                            	//Challenge response authentication
+                            	site.setChallengeResponseAuthentication(true);
+                            }
+                            
                             sso.updateSite(site);
                             this.clearBrowserIterator(request);
                             PortletMessaging.publish(request, "site", "selectedName", siteName);
-                            PortletMessaging.publish(request, "site", "selectedUrl", siteUrl);
                           
+                            PortletMessaging.publish(request, "site", "selectedUrl", siteUrl);
   
+                            PortletMessaging.publish(request, "site", "realm", siteRealm);
+                            PortletMessaging.publish(request, "site", "idField",siteFormID);
+                            PortletMessaging.publish(request, "site", "pwdField", siteFormPWD);
+
                         }
                         else
                         {
-                            sso.addSite(siteName, siteUrl);
+                        	if (siteFormID != null && siteFormID.length() > 0
+                                	&& siteFormPWD != null && siteFormPWD.length()
> 0	)
+                            {
+                    			sso.addSiteFormAuthenticated(siteName, siteUrl, siteRealm, siteFormID,siteFormPWD);
+                    		
+                            }
+                        	else
+                        	{
+                        		sso.addSiteChallengeResponse(siteName, siteUrl, siteRealm);
+                        	}
                             this.clearBrowserIterator(request);
                         }
                     }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/sso/sites-view.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/sso/sites-view.vm?rev=354643&r1=354642&r2=354643&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/sso/sites-view.vm
(original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/sso/sites-view.vm
Tue Dec  6 17:25:37 2005
@@ -90,6 +90,27 @@
       <input type="text" name="site.url" size="40" value="$!currentUrl" class="portlet-form-field-label">
     </td>
   </tr>
+  <tr colspan="2" align="right">
+    <td nowrap class="portlet-section-alternate" align="right">$MESSAGES.getString('realm')&nbsp;</td>
+    <td class="portlet-section-body" align="left">
+      <input type="text" name="site.realm" size="40" value="$!currentRealm" class="portlet-form-field-label">
+    </td>
+  </tr>
+  <tr  align="right">
+  <td colspan="2" nowrap class="portlet-section-alternate" align="right">$MESSAGES.getString('form_authentication_info')&nbsp;</td>
+  </tr>
+  <tr colspan="2" align="right">
+    <td nowrap class="portlet-section-alternate" align="right">$MESSAGES.getString('form_field_id')&nbsp;</td>
+    <td class="portlet-section-body" align="left">
+      <input type="text" name="site.form_field_ID" size="40" value="$!currentFFID" class="portlet-form-field-label">
+    </td>
+  </tr>
+  <tr colspan="2" align="right">
+    <td nowrap class="portlet-section-alternate" align="right">$MESSAGES.getString('form_field_PWD')&nbsp;</td>
+    <td class="portlet-section-body" align="left">
+      <input type="text" name="site.form_field_PWD" size="40" value="$!currentFFPWD" class="portlet-form-field-label">
+    </td>
+  </tr>
 </table>
 <br/>
 <input name='ssoDelete' type='hidden' value=''/>

Modified: portals/jetspeed-2/trunk/components/sso/src/java/org/apache/jetspeed/sso/impl/PersistenceBrokerSSOProvider.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/sso/src/java/org/apache/jetspeed/sso/impl/PersistenceBrokerSSOProvider.java?rev=354643&r1=354642&r2=354643&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/sso/src/java/org/apache/jetspeed/sso/impl/PersistenceBrokerSSOProvider.java
(original)
+++ portals/jetspeed-2/trunk/components/sso/src/java/org/apache/jetspeed/sso/impl/PersistenceBrokerSSOProvider.java
Tue Dec  6 17:25:37 2005
@@ -1073,6 +1073,70 @@
         }        
     }
     
+    /**
+     * Add a new site that uses Form Authentication
+     * @param siteName
+     * @param siteUrl
+     * @param realm
+     * @param userField
+     * @param pwdField
+     * @throws SSOException
+     */
+    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(siteName, ssoSite);            
+        }
+        catch (Exception e)
+        {
+            String msg = "Unable to add SSO Site: " + siteName;
+            logger.error(msg, e);
+            throw new SSOException(msg, e);
+        }  
+    }
+    
+    /**
+     * Add a new site that uses ChallengeResponse Authentication
+     * @param siteName
+     * @param siteUrl
+     * @param realm
+     * @throws SSOException
+     */
+    public void addSiteChallengeResponse(String siteName, String siteUrl, String realm)
+    throws SSOException
+    {
+    	try
+        {
+            SSOSite ssoSite = new SSOSiteImpl();
+            ssoSite.setSiteURL(siteUrl);
+            ssoSite.setName(siteName);
+            ssoSite.setCertificateRequired(false);
+            ssoSite.setAllowUserSet(true);
+            ssoSite.setRealm(realm);
+            ssoSite.setChallengeResponseAuthentication(true);
+             getPersistenceBrokerTemplate().store(ssoSite);
+            this.mapSite.put(siteName, ssoSite);            
+        }
+        catch (Exception e)
+        {
+            String msg = "Unable to add SSO Site: " + siteName;
+            logger.error(msg, e);
+            throw new SSOException(msg, e);
+        }  
+    }
+    
     public void addSite(String siteName, String siteUrl)
     throws SSOException
     {

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/sso/SSOProvider.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/sso/SSOProvider.java?rev=354643&r1=354642&r2=354643&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/sso/SSOProvider.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/sso/SSOProvider.java
Tue Dec  6 17:25:37 2005
@@ -148,4 +148,24 @@
      */
     public Collection getSitesForPrincipal(String userId);
     
+    /**
+     * Add a new site that uses Challenge / Response Authentication
+     * @param siteName
+     * @param siteUrl
+     * @param realm
+     * @throws SSOException
+     */
+    public void addSiteChallengeResponse(String siteName, String siteUrl, String realm) throws
SSOException;
+    
+    /**
+     * Add a new site that uses Form Authentication
+     * @param siteName
+     * @param siteUrl
+     * @param realm
+     * @param userField
+     * @param pwdField
+     * @throws SSOException
+     */
+    public void addSiteFormAuthenticated(String siteName, String siteUrl, String realm, String
userField, String pwdField) throws SSOException;
+    
 }

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/sso.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/sso.xml?rev=354643&r1=354642&r2=354643&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/sso.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/sso.xml Tue Dec  6 17:25:37 2005
@@ -33,7 +33,7 @@
         </property>
         <property name="transactionAttributes">
             <props>
-                <prop key="addSite">PROPAGATION_REQUIRED</prop>
+                <prop key="addSite*">PROPAGATION_REQUIRED</prop>
                 <prop key="removeSite">PROPAGATION_REQUIRED</prop>
                 <prop key="addCredentialsForSite">PROPAGATION_REQUIRED</prop>
                 <prop key="updateCredentialsForSite">PROPAGATION_REQUIRED</prop>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message