JBoss Portal SVN: r7338 - trunk/core/src/bin/portal-core-war/layouts/generic.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-25 06:55:58 -0400 (Fri, 25 May 2007)
New Revision: 7338
Modified:
trunk/core/src/bin/portal-core-war/layouts/generic/index.jsp
Log:
Put back: "Powered by JBoss Portal"
Modified: trunk/core/src/bin/portal-core-war/layouts/generic/index.jsp
===================================================================
--- trunk/core/src/bin/portal-core-war/layouts/generic/index.jsp 2007-05-25 10:52:11 UTC (rev 7337)
+++ trunk/core/src/bin/portal-core-war/layouts/generic/index.jsp 2007-05-25 10:55:58 UTC (rev 7338)
@@ -44,11 +44,9 @@
</div>
</div>
-<!-- TODO: Fix the auto jump in this tag -->
-<!-- <div id="footer-container" class="portal-copyright">Powered by
+<div id="footer-container" class="portal-copyright">Powered by
<a class="portal-copyright" href="http://www.jboss.com/products/jbossportal">JBoss Portal</a><br/>
</div>
--->
<p:region regionName='AJAXFooter' regionID='AJAXFooter'/>
16 years, 11 months
JBoss Portal SVN: r7337 - in trunk/core/src: resources/portal-core-war/WEB-INF/jsp/user and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-05-25 06:52:11 -0400 (Fri, 25 May 2007)
New Revision: 7337
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/editUserRoles.jsp
Log:
JBPORTAL-1428 - Creating a user should take you back to the screen you came from, not back to the members page.
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-05-25 09:40:46 UTC (rev 7336)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-05-25 10:52:11 UTC (rev 7337)
@@ -486,6 +486,8 @@
{
DelegateContext ctx = new DelegateContext();
+ ctx.put("usernamefilter", req.getParameter("usernamefilter"));
+
try
{
User user = userModule.findUserById(req.getParameter("userid"));
@@ -495,31 +497,12 @@
Set userRoles = membershipModule.getRoles(user);
Set roles = roleModule.findRoles();
- Role[] rolesArray = new Role[roles.size()];
- //rolesArray = (Role[])roles.toArray(rolesArray);
- /*Role role;
- DelegateContext rowCtx = null;
- for (int i = 0; i < rolesArray.length; i++)
- {
- int oddeven = i % 3;
- role = rolesArray[i];
- if (oddeven == 0)
- {
- rowCtx = ctx.next("row");
- }
- DelegateContext colCtx = rowCtx.next("col");
- if (userRoles.contains(role))
- {
- colCtx.put("ischecked", "checked");
- }
- colCtx.put("name", role.getName());
- colCtx.put("displayname", role.getDisplayName());
- }*/
-
Role role = null;
+
+
DelegateContext allRolesCtx = null;
for (Iterator it = roles.iterator(); it.hasNext();)
{
@@ -1097,7 +1080,8 @@
if (request.isUserInRole("Admin"))
{
- String userId = request.getParameters().getParameter("userid");
+ String userId = request.getParameters().getParameter("userid");
+ response.setRenderParameter("usernamefilter", request.getParameter("usernamefilter"));
if (request.getParameterMap().keySet().contains("addRoles"))
{
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/editUserRoles.jsp
===================================================================
(Binary files differ)
16 years, 11 months
JBoss Portal SVN: r7336 - in trunk/core/src: main/org/jboss/portal/core/portlet/user and 2 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-05-25 05:40:46 -0400 (Fri, 25 May 2007)
New Revision: 7336
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/editUserRoles.jsp
Log:
JBPORTAL-1440 - changed checkboxes for user - roles assignation to two select boxes - part for UserPortlet
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java 2007-05-25 07:34:56 UTC (rev 7335)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java 2007-05-25 09:40:46 UTC (rev 7336)
@@ -407,7 +407,7 @@
//old stuff
Set roles = roleModule.findRoles();
Role[] rolesArray = new Role[roles.size()];
- rolesArray = (Role[])roles.toArray(rolesArray);
+ //rolesArray = (Role[])roles.toArray(rolesArray);
Role role = null;
DelegateContext allRolesCtx = null;
@@ -682,6 +682,7 @@
response.setRenderParameter("op", OP_SHOWADDROLESTOUSER );
response.setRenderParameter("userid", userId);
+ return;
}
@@ -718,6 +719,7 @@
response.setRenderParameter("op", OP_SHOWADDROLESTOUSER );
response.setRenderParameter("userid", userId);
+ return;
}
List toRemove = Arrays.asList(rolesToRemove);
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-05-25 07:34:56 UTC (rev 7335)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-05-25 09:40:46 UTC (rev 7336)
@@ -41,6 +41,8 @@
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
+import java.util.List;
+import java.util.Arrays;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
@@ -494,8 +496,8 @@
Set roles = roleModule.findRoles();
Role[] rolesArray = new Role[roles.size()];
- rolesArray = (Role[])roles.toArray(rolesArray);
- Role role;
+ //rolesArray = (Role[])roles.toArray(rolesArray);
+ /*Role role;
DelegateContext rowCtx = null;
for (int i = 0; i < rolesArray.length; i++)
{
@@ -514,7 +516,47 @@
colCtx.put("name", role.getName());
colCtx.put("displayname", role.getDisplayName());
+ }*/
+
+ Role role = null;
+
+ DelegateContext allRolesCtx = null;
+ for (Iterator it = roles.iterator(); it.hasNext();)
+ {
+ role = (Role)it.next();
+ allRolesCtx = ctx.next("allRoles");
+
+ allRolesCtx.put("name", role.getName());
+ allRolesCtx.put("displayname", role.getDisplayName());
}
+
+ DelegateContext userRolesCtx = null;
+
+ if (!req.getParameterMap().keySet().contains("selectedRoles"))
+ {
+ for (Iterator it = userRoles.iterator(); it.hasNext();)
+ {
+ role = (Role)it.next();
+ userRolesCtx = ctx.next("userRoles");
+
+ userRolesCtx.put("name", role.getName());
+ userRolesCtx.put("displayname", role.getDisplayName());
+ }
+ }
+ else
+ {
+ String[] selectedRoles = req.getParameterValues("selectedRoles");
+ for (int i = 0; i < selectedRoles.length; i++)
+ {
+ String selectedRole = selectedRoles[i];
+ role = roleModule.findRoleByName(selectedRole);
+
+ userRolesCtx = ctx.next("userRoles");
+
+ userRolesCtx.put("name", role.getName());
+ userRolesCtx.put("displayname", role.getDisplayName());
+ }
+ }
}
catch (IllegalArgumentException e)
{
@@ -1054,27 +1096,116 @@
{
if (request.isUserInRole("Admin"))
{
- String[] selectedRoles = request.getParameterValues("roles");
- String userId = request.getParameters().getParameter("userid");
- try
+
+ String userId = request.getParameters().getParameter("userid");
+
+ if (request.getParameterMap().keySet().contains("addRoles"))
{
- User user = userModule.findUserById(userId);
- Set roles = roleModule.findRolesByNames(selectedRoles);
- membershipModule.assignRoles(user, roles);
- response.setRenderParameter(getOperationName(), OP_SHOWLISTUSERS);
- response.setRenderParameter("usernamefilter", request.getParameter("usernamefilter"));
- response.setRenderParameter("offset", request.getParameter("offset"));
- response.setRenderParameter("usersperpage", request.getParameter("usersperpage"));
+ String[] selectedRoles = request.getParameterValues("assignedRoles");
+ String[] rolesToAdd = request.getParameterValues("rolesToAdd");
+
+ if (selectedRoles == null)
+ {
+ selectedRoles = new String[]{};
+ }
+ if (rolesToAdd == null)
+ {
+
+ if (selectedRoles.length != 0)
+ {
+ response.setRenderParameter("selectedRoles", selectedRoles);
+ }
+
+ response.setRenderParameter("op", OP_SHOWADDROLESTOUSER );
+ response.setRenderParameter("userid", userId);
+ return;
+ }
+
+
+ Set roles = new HashSet();
+ List l1 = Arrays.asList(selectedRoles);
+ List l2 = Arrays.asList(rolesToAdd);
+ roles.addAll(l1);
+ roles.addAll(l2);
+
+ String[] roleNames = new String[roles.size()];
+ roleNames = (String[])roles.toArray(roleNames);
+
+ response.setRenderParameter("selectedRoles", roleNames);
+ response.setRenderParameter("op", OP_SHOWADDROLESTOUSER );
+ response.setRenderParameter("userid", userId);
}
- catch (IllegalArgumentException e)
+ else if (request.getParameterMap().keySet().contains("removeRoles"))
{
- // TODO Auto-generated catch block
- e.printStackTrace();
+
+ String[] selectedRoles = request.getParameterValues("assignedRoles");
+ String[] rolesToRemove = request.getParameterValues("selectedRoles");
+
+ if (selectedRoles == null)
+ {
+ selectedRoles = new String[]{};
+ }
+
+ if (rolesToRemove == null)
+ {
+ if (selectedRoles.length != 0)
+ {
+ response.setRenderParameter("selectedRoles", selectedRoles);
+ }
+
+ response.setRenderParameter("op", OP_SHOWADDROLESTOUSER );
+ response.setRenderParameter("userid", userId);
+ return;
+ }
+
+ List toRemove = Arrays.asList(rolesToRemove);
+
+ Set roles = new HashSet();
+
+ for (int i = 0; i < selectedRoles.length; i++)
+ {
+ String selectedRole = selectedRoles[i];
+
+ if (!toRemove.contains(selectedRole))
+ {
+ roles.add(selectedRole);
+ }
+ }
+
+ String[] roleNames = new String[roles.size()];
+ roleNames = (String[])roles.toArray(roleNames);
+
+ if (roleNames.length != 0)
+ {
+ response.setRenderParameter("selectedRoles", roleNames);
+ }
+
+ response.setRenderParameter("op", OP_SHOWADDROLESTOUSER );
+ response.setRenderParameter("userid", userId);
}
- catch (IdentityException e)
+ else
{
- // TODO Auto-generated catch block
- e.printStackTrace();
+ try
+ {
+ String[] selectedRoles = request.getParameterValues("assignedRoles");
+ User user = userModule.findUserById(userId);
+ Set roles = roleModule.findRolesByNames(selectedRoles);
+ membershipModule.assignRoles(user, roles);
+ response.setRenderParameter(getOperationName(), OP_SHOWLISTUSERS);
+ response.setRenderParameter("usernamefilter", request.getParameter("usernamefilter"));
+ response.setRenderParameter("offset", request.getParameter("offset"));
+ response.setRenderParameter("usersperpage", request.getParameter("usersperpage"));
+ }
+ catch (IllegalArgumentException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (IdentityException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
}
}
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp 2007-05-25 07:34:56 UTC (rev 7335)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp 2007-05-25 09:40:46 UTC (rev 7336)
@@ -43,10 +43,7 @@
</form>
- <form
- name="<portlet:namespace/>cancel"
- action="<portlet:renderURL windowState="normal"><portlet:param name="op" value="showSummary"/></portlet:renderURL>"
- method="post"/>
+
<tr><td><br/></td></tr>
<tr>
<td colspan="3">
@@ -58,6 +55,10 @@
onclick="document.forms['<portlet:namespace/>cancel'].submit();"
value="${n:i18n("Cancel")}"/>
</tr>
+ <form
+ name="<portlet:namespace/>cancel"
+ action="<portlet:renderURL windowState="normal"><portlet:param name="op" value="showSummary"/></portlet:renderURL>"
+ method="post"/>
</table>
</span>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/editUserRoles.jsp
===================================================================
(Binary files differ)
16 years, 11 months
JBoss Portal SVN: r7335 - trunk/theme/src/main/org/jboss/portal/theme.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-25 03:34:56 -0400 (Fri, 25 May 2007)
New Revision: 7335
Added:
trunk/theme/src/main/org/jboss/portal/theme/ThemeTools.java
Log:
forgot to add theme tools class
Added: trunk/theme/src/main/org/jboss/portal/theme/ThemeTools.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/ThemeTools.java (rev 0)
+++ trunk/theme/src/main/org/jboss/portal/theme/ThemeTools.java 2007-05-25 07:34:56 UTC (rev 7335)
@@ -0,0 +1,110 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.theme;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ThemeTools
+{
+
+ /**
+ * Compare 2 windows.
+ *
+ * @param orderString1
+ * @param id1
+ * @param orderString2
+ * @param id2
+ * @return
+ */
+ public static int compareWindowOrder(
+ String orderString1,
+ String id1,
+ String orderString2,
+ String id2)
+ {
+ if (id1 == null)
+ {
+ throw new IllegalArgumentException("No null window id accepted for window 1");
+ }
+ if (id2 == null)
+ {
+ throw new IllegalArgumentException("No null window id accepted for window 2");
+ }
+
+ //
+ if (orderString1 == null)
+ {
+ orderString1 = "";
+ }
+ if (orderString2 == null)
+ {
+ orderString1 = "";
+ }
+
+ int order1 = 0;
+ int order2 = 0;
+
+ //
+ try
+ {
+ order1 = Integer.parseInt(orderString1);
+
+ //
+ try
+ {
+ order2 = Integer.parseInt(orderString2);
+ }
+ catch (NumberFormatException e)
+ {
+ // We have window2>window1
+ order2 = order1 + 1;
+ }
+ }
+ catch (NumberFormatException e1)
+ {
+ try
+ {
+ Integer.parseInt(orderString2);
+
+ // We have order2=0 and order1=1 and thus window1>window2
+ order1 = 1;
+ }
+ catch (NumberFormatException e2)
+ {
+ // Orders have the same value of zero that will lead to the comparison of their ids
+ }
+ }
+
+ // If order are the same we compare the window ids
+ if (order1 == order2)
+ {
+ return orderString1.compareTo(orderString2);
+ }
+ else
+ {
+ return order1 - order2;
+ }
+ }
+}
16 years, 11 months
JBoss Portal SVN: r7334 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-05-25 00:33:56 -0400 (Fri, 25 May 2007)
New Revision: 7334
Modified:
docs/trunk/referenceGuide/en/modules/wsrp.xml
Log:
- Added DTD for producer configuration examples.
Modified: docs/trunk/referenceGuide/en/modules/wsrp.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/wsrp.xml 2007-05-25 04:32:24 UTC (rev 7333)
+++ docs/trunk/referenceGuide/en/modules/wsrp.xml 2007-05-25 04:33:56 UTC (rev 7334)
@@ -523,6 +523,9 @@
<para>
Let's look at the default configuration:
<programlisting><![CDATA[
+<!DOCTYPE producer-configuration PUBLIC "-//JBoss Portal//DTD WSRP Local Producer Configuration 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-wsrp-producer_2_6.dtd">
+<?xml version="1.0" encoding="UTF-8"?>
<producer-configuration>
<registration-configuration fullServiceDescriptionRequiresRegistration="true">
<registration-property-validator>
@@ -627,6 +630,9 @@
service will use the <literal>com.example.portal.SomeCustomRegistrationPolicy</literal> class for its
registration policy.
<programlisting><![CDATA[
+<!DOCTYPE producer-configuration PUBLIC "-//JBoss Portal//DTD WSRP Local Producer Configuration 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-wsrp-producer_2_6.dtd">
+<?xml version="1.0" encoding="UTF-8"?>
<producer-configuration>
<registration-configuration fullServiceDescriptionRequiresRegistration="true">
<registration-policy>com.example.portal.SomeCustomRegistrationPolicy</registration-policy>
16 years, 11 months
JBoss Portal SVN: r7333 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-05-25 00:32:24 -0400 (Fri, 25 May 2007)
New Revision: 7333
Modified:
docs/trunk/referenceGuide/en/modules/wsrp.xml
Log:
- Added information on level of support of WSRP 1.0 spec.
- Added information on processing of Producer descriptors.
- Started adding info about configuration portlet.
- Need to update graphics.
Modified: docs/trunk/referenceGuide/en/modules/wsrp.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/wsrp.xml 2007-05-25 02:37:52 UTC (rev 7332)
+++ docs/trunk/referenceGuide/en/modules/wsrp.xml 2007-05-25 04:32:24 UTC (rev 7333)
@@ -39,6 +39,33 @@
</sect1>
<sect1>
+ <title>Level of support in JBoss Portal</title>
+ <para>The WSRP Technical Committee defined <ulink url="http://www.oasis-open.org/committees/download.php/3073">WSRP
+ Use Profiles</ulink> to help with WSRP interoperability. We will refer to terms defined in that document in
+ this section.
+ </para>
+
+ <para>JBoss Portal provides a Simple level of support for our WSRP Producer except that out-of-band registration
+ is not currently handled. We support in-band registration and persistent local state (which are
+ defined at the Complex level).</para>
+
+ <para>On the Consumer side, JBoss Portal provides a Medium level of support for WSRP, except that we only handle
+ HTML markup (as Portal itself doesn't handle other markup types). We do support explicit portlet cloning and
+ we fully support the PortletManagement interface.</para>
+
+ <para>As far as caching goes, we have Level 1 Producer and Consumer. We support Cookie handling properly on the
+ Consumer and our Producer requires initialization of cookies (as we have found that it improved
+ interoperabilty with some consumers). We don't support custom window states or modes, as Portal doesn't either.
+ We do, however, support CSS on both the Producer (though it's more a function of the portlets than
+ inherent Producer capability) and Consumer.</para>
+
+ <para>While we provide a complete implementation of WSRP 1.0, we do need to go through the
+ <ulink url="http://www.oasis-open.org/committees/download.php/6018">Conformance statements</ulink> and
+ perform more interoperability testing (an area that needs to be better supported by the WSRP Technical
+ Committee and Community at large).</para>
+ </sect1>
+
+ <sect1>
<title>Deploying JBoss Portal's WSRP services</title>
<para>JBoss Portal provides a complete support of WSRP 1.0 standard interfaces and offers
both consumer and producer services. WSRP support is provided by the <emphasis>portal-wsrp.sar</emphasis>
@@ -62,7 +89,7 @@
WS (bundled with JBoss Application Server 4.0.4.GA) that prevents the complete deployment of JBoss
Portal's WSRP service if the user is not online or behind a firewall/proxy. For this reason, we recommend
that you deploy Portal on JBoss Application Server 4.0.5.GA. Alternatively, you can also perform a manual
- upgrade of JBoss WS, in which case we recommend that you use JBoss WS version 1.0.4.GA (and later).
+ upgrade of JBoss WS, in which case we recommend that you use JBoss WS version 1.2.1.GA (and later).
Please follow the instructions on
<ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=WSRP_UpdateJBossWS">how to upgrade JBoss WS</ulink>
as found on <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossPortal">JBoss Portal's wiki</ulink>.
@@ -72,8 +99,9 @@
<sect2 id="wsrp-ports">
<title>Considerations to use WSRP when running Portal on a non-default port</title>
<para>If you have modified the port number on which Portal runs, you will also need
- <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=WSRPChangePorts">update the port information for WSRP</ulink>
- as found on <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossPortal">JBoss Portal's wiki</ulink>.
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=WSRPChangePorts">update the port information for
+ WSRP</ulink> as found on <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossPortal">JBoss Portal's
+ wiki</ulink>.
</para>
</sect2>
@@ -89,10 +117,10 @@
<sect1>
<title>Making a portlet remotable</title>
- <para>JBoss Portal does not, by default, expose local portlets for consumption by remote WSRP consumers. In order
- to make a portlet remotely available, it must be made "remotable" by adding a <emphasis>remotable</emphasis>
- element to the <emphasis>jboss-portlet.xml</emphasis> deployment descriptor for that portlet. If a
- <emphasis>jboss-portlet.xml</emphasis> file does not exist, one must be added to the
+ <para>JBoss Portal does <emphasis role="bold">NOT</emphasis>, by default, expose local portlets for consumption by remote WSRP
+ consumers. In order to make a portlet remotely available, it must be made "remotable" by adding a
+ <emphasis>remotable</emphasis> element to the <emphasis>jboss-portlet.xml</emphasis> deployment descriptor for
+ that portlet. If a <emphasis>jboss-portlet.xml</emphasis> file does not exist, one must be added to the
<emphasis>WEB-INF</emphasis> folder of the web application containing the portlet.
</para>
<para>In the following example, the "BasicPortlet" portlet is specified as being remotable. The
@@ -101,9 +129,7 @@
<para>
<programlisting><![CDATA[
<?xml version="1.0" standalone="yes"?>
-<!DOCTYPE portlet-app PUBLIC
- "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
- "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+<!DOCTYPE portlet-app PUBLIC "-//JBoss Portal//DTD JBoss Portlet 2.6//EN" "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
<portlet-app>
<portlet>
<portlet-name>BasicPortlet</portlet-name>
@@ -113,7 +139,8 @@
</para>
<para>
It is also possible to specify that all the portlets declared within a given <emphasis>jboss-portlet.xml</emphasis>
- file have a specific "remotable" status by default. Usually, this feature will be used to remotely expose
+ file have a specific "remotable" status by default. This is done by adding a single <emphasis>remotable</emphasis>
+ element to the root <emphasis>portlet-app</emphasis> element. Usually, this feature will be used to remotely expose
several portlets without having to specify the status for all the declared portlets. Let's look at an example:
</para>
<para>
@@ -154,7 +181,8 @@
<title>Consuming JBoss Portal's WSRP portlets from a remote Consumer</title>
<para>WSRP Consumers vary a lot as far as how they are configured. Most of them require that you either specify
the URL for the Producer's WSDL definition or the URLs for the individual endpoints. Please refer to your
- Consumer's documentation for specific instructions.
+ Consumer's documentation for specific instructions. For instructions on how to do so in JBoss Portal, please
+ refer to <xref linkend="#consumer_configuration"/>.
</para>
<para>
JBoss Portal's Producer is automatically set up when you deploy a portal instance with the WSRP service.
@@ -170,20 +198,18 @@
</para>
</sect1>
- <sect1>
+ <sect1 id="consumer_configuration">
<title>Consuming remote WSRP portlets in JBoss Portal</title>
<sect2>
<title>Overview</title>
<para>
To be able to consume WSRP portlets exposed by a remote producer, JBoss Portal's WSRP consumer needs to know
- how to access that remote producer. One can configure access to a remote producer via
- <emphasis>*-wsrp.xml</emphasis> descriptors. These files can be dropped in the deploy directory of the JBoss
- application server or nested in .sar files. It is possible to configure access to several different
- producers within a single <emphasis>-wsrp.xml</emphasis> file or use one file per producer.
+ how to access that remote producer. One can configure access to a remote producer using WSRP Producer
+ descriptors. Alternatively, a portlet is provided to configure remote producers.
</para>
<para>
- Once a remote producer has been configured in a <emphasis>-wsrp.xml</emphasis> file, it becomes available
- in the list of portlet provider in the Management portlet on the Admin page of JBoss Portal. You can then
+ Once a remote producer has been configured, it can be made available
+ in the list of portlet providers in the Management portlet on the Admin page of JBoss Portal. You can then
examine the list of portlets that are exposed by this producer and configure the portlets just like you
would for local portlets.
</para>
@@ -194,16 +220,28 @@
identifier in the portlet providers list in the Management portlet of the Admin page. All local portlets
marked as remotable are exposed as remote portlets via the <emphasis>self</emphasis> portlet
provider so that you can check that they work as expected with WSRP. The <emphasis>portal-wsrp.sar</emphasis>
- file contains a <emphasis>default-wsrp.xml</emphasis> that configures this default producer. This file can
- be edited or removed if needed.
+ file contains a WSRP Producer descriptor (<emphasis>default-wsrp.xml</emphasis>) that configures this
+ default producer. This file can be edited or removed if needed.
</para>
+ </sect2>
+
+ <sect2>
+ <title>Configuring a remote producer walk-through</title>
<para>
Let's work through the steps of defining access to a remote producer so that its portlets can be
- consumed within JBoss Portal. We will configure access to BEA's public WSRP producer. To do so, you will
- need to create a <emphasis>-wsrp.xml</emphasis> file (which we will call here
- <emphasis>public-bea-wsrp.xml</emphasis> but the name does not matter as long as it ends with
- <emphasis>-wsrp.xml</emphasis>) as follows:
+ consumed within JBoss Portal. We will configure access to BEA's public WSRP producer. We will first examine
+ how to do so using an XML descriptor then see how the same can be accomplished using the configuration
+ portlet.
+ </para>
+
+ <sect3>
+ <title>Using a WSRP Producer XML descriptor</title>
+
+ <para>We will create a <emphasis>public-bea-wsrp.xml</emphasis> descriptor. Note that the actual name does not
+ matter as long as it ends with <emphasis>-wsrp.xml</emphasis>.
<programlisting><![CDATA[
+<!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD WSRP Remote Producer Configuration 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-wsrp-consumer_2_6.dtd">
<?xml version="1.0" standalone="yes"?>
<deployments>
<deployment>
@@ -222,12 +260,21 @@
This producer descriptor gives access to BEA's public WSRP producer. We will look at the details of the
different elements later. Note for now the <emphasis>producer-id</emphasis> element with a "bea" value. Put
this file in the deploy directory and start the server (with JBoss Portal and its WSRP service deployed).
- </para>
- <para>
+ </para></sect3>
+
+ <sect3>
+ <title>Using the configuration portlet</title>
+ <para>TODO</para>
+ </sect3>
+
+ <sect3>
+ <title>Configuring access to a remote portlet</title>
+ <para>
Let's now look at the Admin page and the Management portlet. Click on the "Portlets" link at the top to
manage the portlets. Once this is done, look at the list of available portlet providers. If all went well,
you should see something similar to this:
+ TODO: update image
<mediaobject>
<imageobject>
<imagedata fileref="images/wsrp/portlets.png" format="png" align="center" valign="middle"/>
@@ -241,6 +288,7 @@
the portlets exposed by the default WSRP producer. The "bea" provider corresponds to BEA's public producer
we just configured. Select it and click on "Change portlet provider". You should now see something similar to:
+ TODO: update image
<mediaobject>
<imageobject>
<imagedata fileref="images/wsrp/bea.png" format="png" align="center" valign="middle"/>
@@ -248,20 +296,46 @@
</mediaobject>
</para>
<para>
- From there on out, you should be able to configure WSRP portlets just as any other. In particular, you
+ From there on out, you should be able to configure WSRP portlets just as any other. In particular, you
can create an instance of one of the remote portlets offered by BEA's public producer just like you would
create an instance of a local portlet and then assign it to a window in a page. If you go to that page, you
should see something similar to below for this portlet:
+ TODO: update image
<mediaobject>
<imageobject>
<imagedata fileref="images/wsrp/result.png" format="png" align="center" valign="middle"/>
</imageobject>
</mediaobject>
</para>
+ </sect3>
</sect2>
<sect2>
+ <title>WSRP Producer descriptors</title>
+
+ <para>
+ A WSRP Producer descriptor is an XML file which name ends in <emphasis>-wsrp.xml</emphasis> and
+ which can be dropped in the deploy directory of the JBoss application server or nested in .sar files. It is
+ possible to configure access to several different producers within a single descriptor or use one file per
+ producer, depending on your needs. The DTD for the WSRP Producer descriptor format can be found at
+ <emphasis>portal-wsrp.sar/dtd/jboss-wsrp-consumer_2_6.dtd</emphasis>.
+ <note>It is important to note how WSRP Producer descriptors are processed. They are read the first time the
+ WSRP service starts and the associated information is then put in the Portal database. Subsequent launch
+ of the WSRP service will use the database-stored information for all producers which identifier is
+ already known to Portal. More specifically, all the descriptors are scanned for producer identifiers.
+ Any identifier that is already known will be bypassed and the configuration associated with this remote
+ producer in the database will be used. If a producer identifier is found that wasn't already in the
+ database, that producer information will be processed and recorded in the database. Therefore, if you
+ wish to delete a producer configuration, you need to delete the associated information in the database
+ (this can be accomplished using the configuration portlet as we shall see in
+ <xref linkend="#consumer-gui"/>) <emphasis>AND</emphasis> remove the associated information in any
+ WSRP Producer descriptor (if such information exists) as the producer will be re-created the next time
+ the WSRP is launched if that information is not removed.
+ </note>
+ </para>
+
+ <sect3>
<title>Required configuration information</title>
<para>Let's now look at which information needs to be provided to configure access to a remote producer.</para>
@@ -304,9 +378,9 @@
<emphasis role="bold"><endpoint-wsdl-url></emphasis> elements
are required for a functional remote producer configuration.
</para>
- </sect2>
+ </sect3>
- <sect2>
+ <sect3>
<title>Optional configuration</title>
<para>It is also possible to provide addtional configuration, which, in some cases, might be important to
establish a proper connection to the remote producer.
@@ -326,7 +400,7 @@
<para>Additionally, some producers require consumers to register with them before authorizing them to access
their offered portlets. If you know that information beforehand, you can provide the required registration
- information in the producer configuration so that the Portal consumer can register with the remote
+ information in the producer configuration so that the Portal consumer can register with the remote
producer when required.
<note>At this time, though, only simple String properties are supported and it is not possible to configure
complex registration data. This should however be sufficient for most cases.</note>
@@ -335,23 +409,56 @@
<para>Registration configuration is done via the <emphasis role="bold"><registration-data></emphasis>
element. Since JBoss Portal can generate the mandatory information for you, if the remote producer does not
require any registration properties, you only need to provide an empty
- <emphasis role="bold"><registration-datat></emphasis> element. Values for the registration properties
+ <emphasis role="bold"><registration-data></emphasis> element. Values for the registration properties
required by the remote producer can be provided via <emphasis role="bold"><property></emphasis>
elements. See the example below for more details. Additionally, you can override the default consumer name
automatically provided by JBoss Portal via the <emphasis role="bold"><consumer-name></emphasis>
element. If you choose to provide a consumer name, please remember that this should uniquely identify your
consumer.
</para>
+ </sect3>
</sect2>
-
<sect2>
<title>Examples</title>
+
+ <para>
+ Here is the configuration of the "self" producer as found in <emphasis>default-wsrp.xml</emphasis> with a
+ cache expiring every five minutes:
+ </para>
+
+ <para>
+ <programlisting><![CDATA[
+<!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD WSRP Remote Producer Configuration 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-wsrp-consumer_2_6.dtd">
+<?xml version="1.0" encoding="UTF-8"?>
+<deployments>
+ <deployment>
+ <wsrp-producer id="self" expiration-cache="300">
+ <!--
+ we need to use the individual endpoint configuration because the configuration via wsdl forces an
+ immediate attempt to access the web service description which is not available yet at this point of deployment
+ -->
+ <endpoint-config>
+ <service-description-url>http://localhost:8080/portal-wsrp/ServiceDescriptionService</service-description-url>
+ <markup-url>http://localhost:8080/portal-wsrp/MarkupService</markup-url>
+ <registration-url>http://localhost:8080/portal-wsrp/RegistrationService</registration-url>
+ <portlet-management-url>http://localhost:8080/portal-wsrp/PortletManagementService</portlet-management-url>
+ </endpoint-config>
+ <registration-data/>
+ </wsrp-producer>
+ </deployment>
+</deployments>]]>
+ </programlisting>
+ </para>
+
<para>Here is an example of a WSRP descriptor with a 2 minute caching time and manual definition of the endpoint
URLs:</para>
<para>
<programlisting><![CDATA[
+<!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD WSRP Remote Producer Configuration 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-wsrp-consumer_2_6.dtd">
<?xml version="1.0" encoding="UTF-8"?>
<deployments>
<deployment>
@@ -380,6 +487,8 @@
<para>
<programlisting><![CDATA[
+<!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD WSRP Remote Producer Configuration 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-wsrp-consumer_2_6.dtd">
<?xml version="1.0" encoding="UTF-8"?>
<deployments>
<deployment>
@@ -463,9 +572,9 @@
<para>
Registration handling behavior can be customized by users to suit their Producer needs. This is
accomplished by providing an implementation of the <emphasis role="bold">RegistrationPolicy</emphasis>
- interface. This interface defines behaviors that are called by Portal's Registration service so that
+ interface. This interface defines methods that are called by Portal's Registration service so that
decisions can be made appropriately. A default registration policy that provides basic
- behaviors is provided and should be enough for most user needs.
+ behavior is provided and should be enough for most user needs.
</para>
<para>
While the default registration policy provides default behavior for most registration-related aspects,
@@ -538,4 +647,4 @@
</para>
</sect2>
</sect1>
-</chapter>
+ </chapter>
16 years, 11 months
JBoss Portal SVN: r7332 - in branches/2_6_CAS_Integration: core/src/resources/portal-core-sar/META-INF and 5 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-05-24 22:37:52 -0400 (Thu, 24 May 2007)
New Revision: 7332
Added:
branches/2_6_CAS_Integration/core/src/resources/portal-server-war/WEB-INF/context.xml
branches/2_6_CAS_Integration/identity/cas/
branches/2_6_CAS_Integration/identity/cas/lib/
branches/2_6_CAS_Integration/identity/cas/lib/cas-server-3.0.7.jar
branches/2_6_CAS_Integration/identity/cas/lib/casclient-lenient.jar
branches/2_6_CAS_Integration/identity/cas/lib/casclient.jar
branches/2_6_CAS_Integration/identity/cas/lib/catalina.jar
branches/2_6_CAS_Integration/identity/cas/lib/spring-2.0.3.jar
branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/AuthenticationService.java
branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationHandler.java
branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationService.java
branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationValve.java
Modified:
branches/2_6_CAS_Integration/core/build.xml
branches/2_6_CAS_Integration/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/2_6_CAS_Integration/identity/build.xml
branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java
Log:
CAS SSO Framework Integration
Modified: branches/2_6_CAS_Integration/core/build.xml
===================================================================
--- branches/2_6_CAS_Integration/core/build.xml 2007-05-24 22:23:32 UTC (rev 7331)
+++ branches/2_6_CAS_Integration/core/build.xml 2007-05-25 02:37:52 UTC (rev 7332)
@@ -341,7 +341,7 @@
<fileset dir="${apache.fileupload.lib}" includes="commons-fileupload.jar"/>
<fileset dir="${jakarta.io.lib}" includes="commons-io.jar"/>
<fileset dir="${freemarker.freemarker.lib}" includes="freemarker.jar"/>
- <fileset dir="${portals.bridges.lib}" includes="portals-bridges-common.jar"/>
+ <fileset dir="${portals.bridges.lib}" includes="portals-bridges-common.jar"/>
</copy>
<!--dtd-->
@@ -721,4 +721,40 @@
</junitreport>
</target>
+ <target name="deploy-explode" depends="output,explode">
+ <require file="${jboss.home}/server/${portal.deploy.dir}"/>
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar" overwrite="true">
+ <fileset dir="${build.lib}/jboss-portal-exploded.sar"/>
+ </copy>
+ </target>
+
+ <target name="explode-ha" depends="init">
+ <explode
+ file="${build.lib}/jboss-portal-ha.sar"
+ todir="${build.lib}"
+ name="jboss-portal-ha-exploded.sar"
+ />
+ </target>
+
+ <target name="deploy-ha-explode" description="Deploy high availability." depends="output-ha,explode-ha">
+ <require file="${jboss.home}/server/${portal-ha.deploy.dir}"/>
+ <copy todir="${jboss.home}/server/${portal-ha.deploy.dir}/jboss-portal-ha.sar" overwrite="true">
+ <fileset dir="${build.lib}/jboss-portal-ha-exploded.sar"/>
+ </copy>
+ </target>
+
+ <target name="deploy-cas" depends="deploy-explode">
+ <require file="${jboss.home}/server/${portal.deploy.dir}"/>
+ <delete file="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar/lib/casclient-lenient.jar"/>
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar/lib" overwrite="true">
+ <fileset dir="../identity/cas/lib" includes="casclient.jar"/>
+ </copy>
+ </target>
+ <target name="deploy-cas-lenient" depends="deploy-explode">
+ <require file="${jboss.home}/server/${portal.deploy.dir}"/>
+ <delete file="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar/lib/casclient.jar"/>
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar/lib" overwrite="true">
+ <fileset dir="../identity/cas/lib" includes="casclient-lenient.jar"/>
+ </copy>
+ </target>
</project>
Modified: branches/2_6_CAS_Integration/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/2_6_CAS_Integration/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-05-24 22:23:32 UTC (rev 7331)
+++ branches/2_6_CAS_Integration/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-05-25 02:37:52 UTC (rev 7332)
@@ -519,6 +519,15 @@
<attribute name="RegisterMBeans">true</attribute>
<attribute name="ConfigFile">conf/identity/identity-config.xml</attribute>
<attribute name="DefaultConfigFile">conf/identity/standardidentity-config.xml</attribute>
+ </mbean>
+ <mbean
+ code="org.jboss.portal.identity.auth.CASAuthenticationService"
+ name="portal:service=Module,type=CASAuthenticationService"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends>portal:service=Module,type=IdentityServiceController</depends>
+ <attribute name="HavingRole"></attribute>
</mbean>
<mbean
Added: branches/2_6_CAS_Integration/core/src/resources/portal-server-war/WEB-INF/context.xml
===================================================================
--- branches/2_6_CAS_Integration/core/src/resources/portal-server-war/WEB-INF/context.xml (rev 0)
+++ branches/2_6_CAS_Integration/core/src/resources/portal-server-war/WEB-INF/context.xml 2007-05-25 02:37:52 UTC (rev 7332)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<Context>
+ <Valve className="org.jboss.portal.identity.auth.CASAuthenticationValve"
+ casLogin="https://localhost/cas/login"
+ casValidate="https://localhost/cas/serviceValidate"
+ casServerName="localhost"
+ authType="FORM"
+ />
+</Context>
Modified: branches/2_6_CAS_Integration/identity/build.xml
===================================================================
--- branches/2_6_CAS_Integration/identity/build.xml 2007-05-24 22:23:32 UTC (rev 7331)
+++ branches/2_6_CAS_Integration/identity/build.xml 2007-05-25 02:37:52 UTC (rev 7332)
@@ -60,7 +60,7 @@
&tools;
&targets;
-
+
<!-- ================================================================== -->
<!-- Initialization -->
<!-- ================================================================== -->
@@ -88,6 +88,17 @@
<!-- Configure thirdparty libraries -->
&libraries;
+
+ <!--TODO: need to add the CAS SSO system dependency to the thirdparty repository. For now, this is just added to identity/cas/lib -->
+ <property name="yale.cas.root" value="cas"/>
+ <property name="yale.cas.lib" value="${yale.cas.root}/lib/"/>
+ <path id="yale.cas.classpath">
+ <pathelement path="${yale.cas.lib}/casclient.jar"/>
+ <pathelement path="${yale.cas.lib}/cas-server-3.0.7.jar"/>
+ <pathelement path="${yale.cas.lib}/catalina.jar"/>
+ <pathelement path="${yale.cas.lib}/spring-2.0.3.jar"/>
+ </path>
+
<path id="library.classpath">
<path refid="sun.servlet.classpath"/>
<path refid="jboss.microcontainer.classpath"/>
@@ -100,6 +111,9 @@
<path refid="junit.junit.classpath"/>
<pathelement location="${project.tools}/lib/ant.jar"/>
<!--<path refid="sun.opends.classpath"/>-->
+ <!-- cas integration -->
+ <path refid="sun.servlet.classpath"/>
+ <path refid="yale.cas.classpath"/>
</path>
<path id="javac.classpath">
Added: branches/2_6_CAS_Integration/identity/cas/lib/cas-server-3.0.7.jar
===================================================================
(Binary files differ)
Property changes on: branches/2_6_CAS_Integration/identity/cas/lib/cas-server-3.0.7.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/2_6_CAS_Integration/identity/cas/lib/casclient-lenient.jar
===================================================================
(Binary files differ)
Property changes on: branches/2_6_CAS_Integration/identity/cas/lib/casclient-lenient.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/2_6_CAS_Integration/identity/cas/lib/casclient.jar
===================================================================
(Binary files differ)
Property changes on: branches/2_6_CAS_Integration/identity/cas/lib/casclient.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/2_6_CAS_Integration/identity/cas/lib/catalina.jar
===================================================================
(Binary files differ)
Property changes on: branches/2_6_CAS_Integration/identity/cas/lib/catalina.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/2_6_CAS_Integration/identity/cas/lib/spring-2.0.3.jar
===================================================================
(Binary files differ)
Property changes on: branches/2_6_CAS_Integration/identity/cas/lib/spring-2.0.3.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/AuthenticationService.java
===================================================================
--- branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/AuthenticationService.java (rev 0)
+++ branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/AuthenticationService.java 2007-05-25 02:37:52 UTC (rev 7332)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.identity.auth;
+
+/*
+ * Created on May 24, 2007
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public interface AuthenticationService
+{
+ public boolean authenticate(String username,String password);
+}
Added: branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationHandler.java
===================================================================
--- branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationHandler.java (rev 0)
+++ branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationHandler.java 2007-05-25 02:37:52 UTC (rev 7332)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.identity.auth;
+
+
+//jmx related
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
+
+
+import org.jasig.cas.authentication.handler.AuthenticationException;
+import org.jasig.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler;
+import org.jasig.cas.authentication.principal.UsernamePasswordCredentials;
+
+
+import org.jboss.portal.identity.auth.AuthenticationService;
+
+/*
+ * Created on May 23, 2007
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class CASAuthenticationHandler extends
+AbstractUsernamePasswordAuthenticationHandler
+{
+ /**
+ *
+ */
+ protected boolean authenticateUsernamePasswordInternal(UsernamePasswordCredentials credentials) throws AuthenticationException
+ {
+ try
+ {
+ boolean status = false;
+
+ String username = credentials.getUsername();
+ String password = credentials.getPassword();
+
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ AuthenticationService authService = (AuthenticationService)
+ MBeanProxy.get(AuthenticationService.class,new ObjectName("portal:service=Module,type=CASAuthenticationService"),mbeanServer);
+
+ //Perform this operation in the context of a UserTransaction
+ status = authService.authenticate(username, password);
+
+ return status;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return false;
+ }
+ }
+}
Added: branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationService.java
===================================================================
--- branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationService.java (rev 0)
+++ branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationService.java 2007-05-25 02:37:52 UTC (rev 7332)
@@ -0,0 +1,164 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.identity.auth;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+
+import org.apache.log4j.Logger;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.User;
+
+/*
+ * Created on May 24, 2007
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class CASAuthenticationService implements AuthenticationService
+{
+ private static Logger log = Logger.getLogger(CASAuthenticationService.class);
+
+ private UserModule userModule = null;
+ private UserProfileModule profileModule = null;
+ private MembershipModule membershipModule = null;
+ private String havingRole = null;
+
+ /**
+ *
+ *
+ */
+ public void start()
+ {
+ try
+ {
+ InitialContext initialContext = new InitialContext();
+
+ this.userModule = (UserModule)initialContext.lookup("java:/portal/UserModule");
+ this.profileModule = (UserProfileModule)initialContext.lookup("java:/portal/UserProfileModule");
+ this.membershipModule = (MembershipModule)initialContext.lookup("java:/portal/MembershipModule");
+ }
+ catch(Exception e)
+ {
+ log.error(this, e);
+ this.stop();
+ }
+ }
+
+ /**
+ *
+ *
+ */
+ public void stop()
+ {
+ this.userModule = null;
+ this.profileModule = null;
+ this.membershipModule = null;
+ this.havingRole = null;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getHavingRole()
+ {
+ return havingRole;
+ }
+
+ /**
+ *
+ * @param havingRole
+ */
+ public void setHavingRole(String havingRole)
+ {
+ this.havingRole = havingRole;
+ }
+
+ /**
+ *
+ */
+ public boolean authenticate(String username, String password)
+ {
+ try
+ {
+ boolean status = false;
+
+ InitialContext initialContext = new InitialContext();
+ SessionFactory sessionFactory = (SessionFactory)initialContext.lookup("java:/portal/IdentitySessionFactory");
+ Session session = sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+
+ User user = this.userModule.findUserByUserName(username);
+ if(user != null)
+ {
+ //Check and make sure the user account is enabled
+ Boolean enabled = (Boolean)this.profileModule.getProperty(user, User.INFO_USER_ENABLED);
+ if(enabled != null || enabled.booleanValue())
+ {
+ //Check and make sure user has proper role setup
+ if(this.havingRole != null && this.havingRole.trim().length()>0)
+ {
+ boolean hasTheRole = false;
+ Set roles = this.membershipModule.getRoles(user);
+ for (Iterator i = roles.iterator(); i.hasNext();)
+ {
+ Role role = (Role)i.next();
+ if (this.havingRole.equals(role.getName()))
+ {
+ hasTheRole = true;
+ break;
+ }
+ }
+ if (!hasTheRole)
+ {
+ return false;
+ }
+ }
+
+ //Now perform validation
+ status = user.validatePassword(password);
+ }
+ }
+
+ tx.commit();
+ session.close();
+
+ return status;
+ }
+ catch(Exception e)
+ {
+ log.error(this, e);
+ return false;
+ }
+ }
+}
Added: branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationValve.java
===================================================================
--- branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationValve.java (rev 0)
+++ branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/CASAuthenticationValve.java 2007-05-25 02:37:52 UTC (rev 7332)
@@ -0,0 +1,425 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.identity.auth;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.security.Principal;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.Session;
+import org.apache.catalina.authenticator.Constants;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.valves.ValveBase;
+
+import edu.yale.its.tp.cas.client.*;
+
+/*
+ * Created on May 23, 2007
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class CASAuthenticationValve extends ValveBase
+{
+ /**
+ * The name of the filter initialization parameter the value of which should
+ * be the https: address of the CAS Login servlet. Optional parameter, but
+ * required for successful redirection of unauthenticated requests to
+ * authentication.
+ */
+ public final static String LOGIN_INIT_PARAM = "edu.yale.its.tp.cas.client.filter.loginUrl";
+
+ /**
+ * The name of the filter initialization parameter the value of which must be
+ * the https: address of the CAS Validate servlet. Must be a CAS 2.0 validate
+ * servlet (CAS 1.0 non-XML won't suffice). Required parameter.
+ */
+ public final static String VALIDATE_INIT_PARAM = "edu.yale.its.tp.cas.client.filter.validateUrl";
+
+ /**
+ * The name of the filter initialization parameter the value of which must be
+ * the address of the service this filter is filtering. The filter will use
+ * this as the service parameter for CAS login and validation. Either this
+ * parameter or SERVERNAME_INIT_PARAM must be set.
+ */
+ public final static String SERVICE_INIT_PARAM = "edu.yale.its.tp.cas.client.filter.serviceUrl";
+
+ /**
+ * The name of the filter initialization parameter the vlaue of which must be
+ * the server name, e.g. www.yale.edu , of the service this filter is
+ * filtering. The filter will construct from this name and the request the
+ * full service parameter for CAS login and validation.
+ */
+ public final static String SERVERNAME_INIT_PARAM = "edu.yale.its.tp.cas.client.filter.serverName";
+
+ /**
+ * The name of the filter initialization parameter the value of which must be
+ * the String that should be sent as the "renew" parameter on the request for
+ * login and validation. This should either be "true" or not be set. It is
+ * mutually exclusive with GATEWAY.
+ */
+ public final static String RENEW_INIT_PARAM = "edu.yale.its.tp.cas.client.filter.renew";
+
+ /**
+ * The name of the filter initialization parameter the value of which must be
+ * a whitespace delimited list of services (ProxyTicketReceptors) authorized
+ * to proxy authentication to the service filtered by this Filter. These must
+ * be https: URLs. This parameter is optional - not setting it results in no
+ * proxy tickets being acceptable.
+ */
+ public final static String AUTHORIZED_PROXY_INIT_PARAM = "edu.yale.its.tp.cas.client.filter.authorizedProxy";
+
+ /**
+ * The name of the filter initialization parameter the value of which must be
+ * the https: URL to which CAS should send Proxy Granting Tickets when this
+ * filter validates tickets.
+ */
+ public final static String PROXY_CALLBACK_INIT_PARAM = "edu.yale.its.tp.cas.client.filter.proxyCallbackUrl";
+
+ /**
+ * The name of the filter initialization parameter the value of which
+ * indicates whether this filter should wrap requests to expose the
+ * authenticated username.
+ */
+ public final static String WRAP_REQUESTS_INIT_PARAM = "edu.yale.its.tp.cas.client.filter.wrapRequest";
+
+ /**
+ * The name of the filter initialization parameter the value of which is the
+ * value the Filter should send for the gateway parameter on the CAS login
+ * request.
+ */
+ public final static String GATEWAY_INIT_PARAM = "edu.yale.its.tp.cas.client.filter.gateway";
+
+ // Session attributes used by this filter
+
+ /**
+ * <p>
+ * Session attribute in which the username is stored.
+ * </p>
+ */
+ public final static String CAS_FILTER_USER = "edu.yale.its.tp.cas.client.filter.user";
+
+ /**
+ * Session attribute in which the CASReceipt is stored.
+ */
+ public final static String CAS_FILTER_RECEIPT = "edu.yale.its.tp.cas.client.filter.receipt";
+
+ // *********************************************************************
+ // Configuration state
+ /** Secure URL whereat CAS offers its login service. */
+ private String casLogin;
+
+ /** Secure URL whereat CAS offers its CAS 2.0 validate service */
+ private String casValidate;
+
+ /** Filtered service URL for use as service parameter to login and validate */
+ private String casServiceUrl;
+
+ /**
+ * Name of server, for use in assembling service URL for use as service
+ * parameter to login and validate.
+ */
+ private String casServerName;
+
+ /**
+ * Secure URL whereto this filter should ask CAS to send Proxy Granting
+ * Tickets.
+ */
+ private String casProxyCallbackUrl;
+
+ /** True if renew parameter should be set on login and validate */
+ private boolean casRenew;
+
+ /** True if this filter should set gateway=true on login redirect */
+ private boolean casGateway = false;
+
+ /**
+ * List of ProxyTicketReceptor URLs of services authorized to proxy to the
+ * path behind this filter.
+ */
+ private List authorizedProxies = new ArrayList();
+
+ private String authType = null;
+
+ public String getCasLogin()
+ {
+ return casLogin;
+ }
+
+ public void setCasLogin(String casLogin)
+ {
+ this.casLogin = casLogin;
+ }
+
+ public String getCasServerName()
+ {
+ return casServerName;
+ }
+
+ public void setCasServerName(String casServerName)
+ {
+ this.casServerName = casServerName;
+ }
+
+ public String getCasValidate()
+ {
+ return casValidate;
+ }
+
+ public void setCasValidate(String casValidate)
+ {
+ this.casValidate = casValidate;
+ }
+
+ public String getAuthType()
+ {
+ return authType;
+ }
+
+ public void setAuthType(String authType)
+ {
+ this.authType = authType;
+ }
+
+ /**
+ *
+ */
+ public void invoke(Request request, Response response) throws IOException,
+ ServletException
+ {
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpSession session = httpRequest.getSession();
+ this.casRenew = true; // this value helps with logout...otherwise user
+ // is never able to logout
+
+ String requestURI = request.getRequestURI();
+ if ((requestURI.indexOf("/auth/") != -1
+ || requestURI.indexOf("/authsec/") != -1 || requestURI
+ .indexOf("/sec/") != -1)
+ && request.getParameter("ticket") == null
+ && session.getAttribute(CAS_FILTER_USER) == null)
+ {
+ // perform CAS login by going to the CAS authentication server
+ redirectToCAS((HttpServletRequest) request,
+ (HttpServletResponse) response);
+ return;
+ }
+
+ // perform CAS logout if needed
+ if (request.getParameter("ticket") != null
+ && session.getAttribute(CAS_FILTER_USER) == null)
+ {
+ CASReceipt receipt = null;
+ try
+ {
+ receipt = getAuthenticatedUser(httpRequest);
+ }
+ catch (CASAuthenticationException e)
+ {
+ throw new ServletException(e);
+ }
+
+ if (!isReceiptAcceptable(receipt))
+ {
+ throw new ServletException(
+ "Authentication was technically successful but rejected as a matter of policy. ["
+ + receipt + "]");
+ }
+
+ session.setAttribute(CAS_FILTER_USER, receipt.getUserName());
+ session.setAttribute(CAS_FILTER_RECEIPT, receipt);
+
+ // perform the portal JAAS authentication
+ String user = receipt.getUserName();
+ request.setAttribute("ssoSuccess", new Boolean(true));
+ Principal principal = ((Context) this.container).getRealm()
+ .authenticate(user, (String) null);
+ if (principal != null)
+ {
+ this.register(request, response, principal, this.authType, user,
+ (String) null);
+ }
+ }
+
+ // continue processing the request
+ this.getNext().invoke(request, response);
+ }
+
+ /**
+ * Register an authenticated Principal and authentication type in our
+ * request, in the current session (if there is one), and with our
+ * SingleSignOn valve, if there is one. Set the appropriate cookie to be
+ * returned.
+ *
+ * @param request
+ * The servlet request we are processing
+ * @param response
+ * The servlet response we are generating
+ * @param principal
+ * The authenticated Principal to be registered
+ * @param authType
+ * The authentication type to be registered
+ * @param username
+ * Username used to authenticate (if any)
+ * @param password
+ * Password used to authenticate (if any)
+ */
+ private void register(Request request, Response response,
+ Principal principal, String authType, String username, String password)
+ {
+ // Cache the authentication information in our request
+ request.setAuthType(authType);
+ request.setUserPrincipal(principal);
+
+ Session session = request.getSessionInternal(false);
+ // Cache the authentication information in our session, if any
+ if (session != null)
+ {
+ session.setAuthType(authType);
+ session.setPrincipal(principal);
+ if (username != null)
+ {
+ session.setNote(Constants.SESS_USERNAME_NOTE, username);
+ }
+ else
+ {
+ session.removeNote(Constants.SESS_USERNAME_NOTE);
+ }
+ if (password != null)
+ {
+ session.setNote(Constants.SESS_PASSWORD_NOTE, password);
+ }
+ else
+ {
+ session.removeNote(Constants.SESS_PASSWORD_NOTE);
+ }
+ }
+ }
+
+ // CAS related utility
+ // methods---------------------------------------------------------------------------------------------------------
+ /**
+ * Is this receipt acceptable as evidence of authentication by credentials
+ * that would have been acceptable to this path? Current implementation
+ * checks whether from renew and whether proxy was authorized.
+ *
+ * @param receipt
+ * @return true if acceptable, false otherwise
+ */
+ private boolean isReceiptAcceptable(CASReceipt receipt)
+ {
+ if (receipt == null) throw new IllegalArgumentException(
+ "Cannot evaluate a null receipt.");
+ if (this.casRenew && !receipt.isPrimaryAuthentication())
+ {
+ return false;
+ }
+ if (receipt.isProxied())
+ {
+ if (!this.authorizedProxies.contains(receipt.getProxyingService()))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Converts a ticket parameter to a CASReceipt, taking into account an
+ * optionally configured trusted proxy in the tier immediately in front of
+ * us.
+ *
+ * @throws ServletException -
+ * when unable to get service for request
+ * @throws CASAuthenticationException -
+ * on authentication failure
+ */
+ private CASReceipt getAuthenticatedUser(HttpServletRequest request)
+ throws ServletException, CASAuthenticationException
+ {
+ ProxyTicketValidator pv = null;
+
+ pv = new ProxyTicketValidator();
+ pv.setCasValidateUrl(casValidate);
+ pv.setServiceTicket(request.getParameter("ticket"));
+ pv.setService(getService(request));
+ pv.setRenew(Boolean.valueOf(casRenew).booleanValue());
+ if (casProxyCallbackUrl != null)
+ {
+ pv.setProxyCallbackUrl(casProxyCallbackUrl);
+ }
+
+ return CASReceipt.getReceipt(pv);
+ }
+
+ /**
+ * Returns either the configured service or figures it out for the current
+ * request. The returned service is URL-encoded.
+ */
+ private String getService(HttpServletRequest request)
+ throws ServletException
+ {
+ String serviceString;
+
+ // ensure we have a server name or service name
+ if (casServerName == null && casServiceUrl == null) throw new ServletException(
+ "need one of the following configuration "
+ + "parameters: edu.yale.its.tp.cas.client.filter.serviceUrl or "
+ + "edu.yale.its.tp.cas.client.filter.serverName");
+
+ // use the given string if it's provided
+ if (casServiceUrl != null)
+ {
+ serviceString = URLEncoder.encode(casServiceUrl);
+ }
+ else
+ {
+ // otherwise, return our best guess at the service
+ serviceString = Util.getService(request, casServerName);
+ }
+
+ return serviceString;
+ }
+
+ /**
+ * Redirects the user to CAS, determining the service from the request.
+ */
+ private void redirectToCAS(HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException
+ {
+ String casLoginString = casLogin + "?service="
+ + getService((HttpServletRequest) request)
+ + ((casRenew) ? "&renew=true" : "")
+ + (casGateway ? "&gateway=true" : "");
+
+ ((HttpServletResponse) response).sendRedirect(casLoginString);
+ }
+}
Modified: branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java
===================================================================
--- branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java 2007-05-24 22:23:32 UTC (rev 7331)
+++ branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java 2007-05-25 02:37:52 UTC (rev 7332)
@@ -147,14 +147,29 @@
protected boolean validatePassword(final String inputPassword, String expectedPassword)
{
+ HttpServletRequest request = null;
+ try
+ {
+ request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
+ }
+ catch(Exception e)
+ {
+ log.error(this,e);
+ throw new RuntimeException(e);
+ }
+
+ Object ssoSuccess = request.getAttribute("ssoSuccess");
+ if(ssoSuccess != null)
+ {
+ return true;
+ }
+
if (inputPassword != null)
{
try
{
try
- {
- HttpServletRequest request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
-
+ {
UserStatus userStatus = getUserStatus(inputPassword);
if (userStatus == UserStatus.DISABLE)
16 years, 11 months
JBoss Portal SVN: r7331 - trunk/common/src/main/org/jboss/portal/common.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-24 18:23:32 -0400 (Thu, 24 May 2007)
New Revision: 7331
Modified:
trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java
Log:
minor
Modified: trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java 2007-05-24 22:21:29 UTC (rev 7330)
+++ trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java 2007-05-24 22:23:32 UTC (rev 7331)
@@ -23,7 +23,7 @@
package org.jboss.portal.common;
/**
- * Thrown when a code join point is not executable.
+ * Thrown when a code join point is not implemented.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
16 years, 11 months
JBoss Portal SVN: r7330 - trunk/common/src/main/org/jboss/portal/common.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-24 18:21:29 -0400 (Thu, 24 May 2007)
New Revision: 7330
Modified:
trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java
Log:
minor
Modified: trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java 2007-05-24 15:35:45 UTC (rev 7329)
+++ trunk/common/src/main/org/jboss/portal/common/NotYetImplemented.java 2007-05-24 22:21:29 UTC (rev 7330)
@@ -23,6 +23,8 @@
package org.jboss.portal.common;
/**
+ * Thrown when a code join point is not executable.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
@@ -33,6 +35,11 @@
super("Not yet implemented");
}
+ /**
+ * Constructor that takes a feature name for formatting the message.
+ *
+ * @param featureName the feature name that is not implemented
+ */
public NotYetImplemented(String featureName)
{
super("Feature: " + featureName + " is not yet implemented");
16 years, 11 months
JBoss Portal SVN: r7329 - in trunk/core/src: resources/portal-core-war/WEB-INF/classes and 1 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-05-24 11:35:45 -0400 (Thu, 24 May 2007)
New Revision: 7329
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp
Log:
JBPORTAL-1440 - changed checkboxes for user - roles assignation to two select boxes - part for RolePortlet
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java 2007-05-24 14:26:46 UTC (rev 7328)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java 2007-05-24 15:35:45 UTC (rev 7329)
@@ -52,6 +52,10 @@
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Set;
+import java.util.Map;
+import java.util.HashSet;
+import java.util.Arrays;
+import java.util.List;
/**
* This portlet aims at managing roles of users.
@@ -144,6 +148,7 @@
protected void doView(JBossRenderRequest req, JBossRenderResponse resp)
throws PortletException, PortletSecurityException, IOException
{
+
if (req.isUserInRole(ADMIN_ROLE))
{
resp.setContentType("text/html");
@@ -399,29 +404,50 @@
ctx.put("userfullname", getFullName(bundle, user));
Set userRoles = membershipModule.getRoles(user);
+ //old stuff
Set roles = roleModule.findRoles();
Role[] rolesArray = new Role[roles.size()];
rolesArray = (Role[])roles.toArray(rolesArray);
Role role = null;
- DelegateContext rowCtx = null;
- for (int i = 0; i < rolesArray.length; i++)
+
+ DelegateContext allRolesCtx = null;
+ for (Iterator it = roles.iterator(); it.hasNext();)
{
- int oddeven = i % 3;
- role = rolesArray[i];
- if (oddeven == 0)
+ role = (Role)it.next();
+ allRolesCtx = ctx.next("allRoles");
+
+ allRolesCtx.put("name", role.getName());
+ allRolesCtx.put("displayname", role.getDisplayName());
+ }
+
+ DelegateContext userRolesCtx = null;
+
+ if (!req.getParameterMap().keySet().contains("selectedRoles"))
+ {
+ for (Iterator it = userRoles.iterator(); it.hasNext();)
{
- rowCtx = ctx.next("row");
+ role = (Role)it.next();
+ userRolesCtx = ctx.next("userRoles");
+
+ userRolesCtx.put("name", role.getName());
+ userRolesCtx.put("displayname", role.getDisplayName());
}
+ }
+ else
+ {
+ String[] selectedRoles = req.getParameterValues("selectedRoles");
+ for (int i = 0; i < selectedRoles.length; i++)
+ {
+ String selectedRole = selectedRoles[i];
+ role = roleModule.findRoleByName(selectedRole);
- DelegateContext colCtx = rowCtx.next("col");
- if (userRoles.contains(role))
- {
- colCtx.put("ischecked", "checked");
+ userRolesCtx = ctx.next("userRoles");
+
+ userRolesCtx.put("name", role.getName());
+ userRolesCtx.put("displayname", role.getDisplayName());
}
+ }
- colCtx.put("name", role.getName());
- colCtx.put("displayname", role.getDisplayName());
- }
}
catch (IllegalArgumentException e)
{
@@ -633,25 +659,113 @@
*/
public void addRolesToUser(JBossActionRequest request, JBossActionResponse response)
{
+
if (request.isUserInRole(ADMIN_ROLE))
{
- String[] selectedRoles = request.getParameterValues("roles");
String userId = request.getParameters().getParameter("userid");
- try
+ if (request.getParameterMap().keySet().contains("addRoles"))
{
- User user = userModule.findUserById(userId);
- Set roles = roleModule.findRolesByNames(selectedRoles);
- membershipModule.assignRoles(user, roles);
+ String[] selectedRoles = request.getParameterValues("assignedRoles");
+ String[] rolesToAdd = request.getParameterValues("rolesToAdd");
+
+ if (selectedRoles == null)
+ {
+ selectedRoles = new String[]{};
+ }
+ if (rolesToAdd == null)
+ {
+
+ if (selectedRoles.length != 0)
+ {
+ response.setRenderParameter("selectedRoles", selectedRoles);
+ }
+
+ response.setRenderParameter("op", OP_SHOWADDROLESTOUSER );
+ response.setRenderParameter("userid", userId);
+ }
+
+
+ Set roles = new HashSet();
+ List l1 = Arrays.asList(selectedRoles);
+ List l2 = Arrays.asList(rolesToAdd);
+ roles.addAll(l1);
+ roles.addAll(l2);
+
+ String[] roleNames = new String[roles.size()];
+ roleNames = (String[])roles.toArray(roleNames);
+
+ response.setRenderParameter("selectedRoles", roleNames);
+ response.setRenderParameter("op", OP_SHOWADDROLESTOUSER );
+ response.setRenderParameter("userid", userId);
}
- catch (IllegalArgumentException e)
+ else if (request.getParameterMap().keySet().contains("removeRoles"))
{
- // TODO Auto-generated catch block
- e.printStackTrace();
+
+ String[] selectedRoles = request.getParameterValues("assignedRoles");
+ String[] rolesToRemove = request.getParameterValues("selectedRoles");
+
+ if (selectedRoles == null)
+ {
+ selectedRoles = new String[]{};
+ }
+
+ if (rolesToRemove == null)
+ {
+ if (selectedRoles.length != 0)
+ {
+ response.setRenderParameter("selectedRoles", selectedRoles);
+ }
+
+ response.setRenderParameter("op", OP_SHOWADDROLESTOUSER );
+ response.setRenderParameter("userid", userId);
+ }
+
+ List toRemove = Arrays.asList(rolesToRemove);
+
+ Set roles = new HashSet();
+
+ for (int i = 0; i < selectedRoles.length; i++)
+ {
+ String selectedRole = selectedRoles[i];
+
+ if (!toRemove.contains(selectedRole))
+ {
+ roles.add(selectedRole);
+ }
+ }
+
+ String[] roleNames = new String[roles.size()];
+ roleNames = (String[])roles.toArray(roleNames);
+
+ if (roleNames.length != 0)
+ {
+ response.setRenderParameter("selectedRoles", roleNames);
+ }
+
+ response.setRenderParameter("op", OP_SHOWADDROLESTOUSER );
+ response.setRenderParameter("userid", userId);
}
- catch (IdentityException e)
+ else
{
- // TODO Auto-generated catch block
- e.printStackTrace();
+
+ String[] selectedRoles = request.getParameterValues("assignedRoles");
+
+ try
+ {
+ User user = userModule.findUserById(userId);
+ Set roles = roleModule.findRolesByNames(selectedRoles);
+ membershipModule.assignRoles(user, roles);
+ }
+ catch (IllegalArgumentException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (IdentityException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
}
}
@@ -664,6 +778,8 @@
*/
public void removeRole(JBossActionRequest req, JBossActionResponse resp)
{
+
+
if (req.isUserInRole(ADMIN_ROLE))
{
String roleId = req.getParameters().getParameter("roleid");
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2007-05-24 14:26:46 UTC (rev 7328)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2007-05-24 15:35:45 UTC (rev 7329)
@@ -270,6 +270,7 @@
PREVIOUSPAGE=Previous page
ASSIGNROLES=Assign roles
+ASSIGNEDROLES=Roles to assign
ROLESAVAILABLE=Available roles
EDITROLESFORUSER=Edit roles for the user
@@ -293,6 +294,8 @@
ROLE_EDIT_MEMBERS=Edit role members
ROLE_MAINLIST=Back to Role Edit
ROLE_EDIT_USER=Editing users in Role
+ROLE_ADD=Add roles
+ROLE_REMOVE=Remove roles
ROLE_ERROR_DISPLAYNAMEALREADYEXISTS=There is already a role with that display name
ROLE_ERROR_NAMEALREADYEXISTS=There is already a role with that name
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp 2007-05-24 14:26:46 UTC (rev 7328)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp 2007-05-24 15:35:45 UTC (rev 7329)
@@ -8,19 +8,40 @@
<br/>
<table>
<tr>
- <th colspan="3">${n:i18n("ROLESAVAILABLE")}</th>
+ <th>${n:i18n("ROLESAVAILABLE")}</th>
+ <th/>
+ <th>${n:i18n("ASSIGNEDROLES")}</th>
</tr>
<form name="<portlet:namespace/>editRoles" method="post" action="<portlet:actionURL><portlet:param name="op" value="addRolesToUser"/></portlet:actionURL>">
<input type="hidden" name="userid" value="${n:out("userid")}"/>
- <n:iterate ctx="row">
- <tr>
- <n:iterate ctx="col">
- <td><input type="checkbox" name="roles"
- value="${n:out("row.col.name")}" ${n:out("row.col.ischecked")}>${n:out("row.col.displayname")}
- </td>
- </n:iterate>
- </tr>
+
+ <n:iterate ctx="userRoles">
+ <input type="hidden" name="assignedRoles" value="${n:out("userRoles.name")}"/>
</n:iterate>
+
+ <tr>
+ <td style="vertical-align:top;">
+ <select name="rolesToAdd" size="6" multiple="true">
+ <n:iterate ctx="allRoles">
+ <option value="${n:out("allRoles.name")}">${n:out("allRoles.displayname")}</option>
+ </n:iterate>
+ </select>
+ </td>
+ <td>
+ <input name="addRoles" class="portlet-form-button" type="submit" value="${n:i18n("ROLE_ADD")}"/>
+ <br/>
+ <input name="removeRoles" class="portlet-form-button" type="submit" value="${n:i18n("ROLE_REMOVE")}"/>
+ </td>
+ <td style="vertical-align:top;">
+ <select name="selectedRoles" size="6" multiple="true">
+ <n:iterate ctx="userRoles">
+ <option value="${n:out("userRoles.name")}">${n:out("userRoles.displayname")}</option>
+ </n:iterate>
+ </select>
+ </td>
+ </tr>
+
+
</form>
<form
name="<portlet:namespace/>cancel"
@@ -38,4 +59,5 @@
value="${n:i18n("Cancel")}"/>
</tr>
</table>
-</span>
\ No newline at end of file
+</span>
+
16 years, 11 months