Author: thomas.heute(a)jboss.com
Date: 2007-08-10 11:00:02 -0400 (Fri, 10 Aug 2007)
New Revision: 7897
Added:
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutCommandFactoryService.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutURLFactory.java
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/security/src/main/org/jboss/portal/security/impl/jacc/JACCPortalAuthorizationManager.java
Log:
- JBPORTAL-1612: Let the user specify a redirection on the signout URL mapping
- Sign Out, URL factory now specify the redirection location
- JBPORTAL-1590: Fix logging
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java 2007-08-10
14:56:56 UTC (rev 7896)
+++
trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java 2007-08-10
15:00:02 UTC (rev 7897)
@@ -43,7 +43,7 @@
/** . */
private String location;
-
+
public SignOutCommand()
{
this(null);
@@ -58,6 +58,11 @@
{
return info;
}
+
+ public String getLocation()
+ {
+ return location;
+ }
public ControllerResponse execute() throws ControllerException
{
Copied:
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutCommandFactory.java
(from rev 7895,
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutCommandFactory.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutCommandFactory.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutCommandFactory.java 2007-08-10
15:00:02 UTC (rev 7897)
@@ -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.core.controller.command.mapper;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface SignOutCommandFactory
+{
+
+}
+
Copied:
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutCommandFactoryService.java
(from rev 7895,
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutCommandFactoryService.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutCommandFactoryService.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutCommandFactoryService.java 2007-08-10
15:00:02 UTC (rev 7897)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * 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.core.controller.command.mapper;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.command.SignOutCommand;
+import org.jboss.portal.server.ServerInvocation;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class SignOutCommandFactoryService extends AbstractCommandFactory implements
SignOutCommandFactory
+{
+
+ public ControllerCommand doMapping(ControllerContext controllerContext,
ServerInvocation invocation, String host,
+ String contextPath, String requestPath)
+ {
+ String location = null;
+ ParameterMap parameterMap =
controllerContext.getServerInvocation().getServerContext().getQueryParameterMap();
+ if (parameterMap != null)
+ {
+ try
+ {
+ if (parameterMap.get("location") != null)
+ {
+ location = URLDecoder.decode(((String[])
parameterMap.get("location"))[0], "UTF-8");
+ }
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // ignore
+ }
+ }
+
+ if (location == null)
+ {
+ return new SignOutCommand();
+ }
+ else
+ {
+ return new SignOutCommand(location);
+ }
+ }
+
+}
+
Copied:
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutURLFactory.java
(from rev 7895,
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutURLFactory.java)
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutURLFactory.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SignOutURLFactory.java 2007-08-10
15:00:02 UTC (rev 7897)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * 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.core.controller.command.mapper;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.command.SignOutCommand;
+import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerURL;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class SignOutURLFactory extends URLFactoryDelegate
+{
+
+ /** . */
+ private String path;
+
+ public ServerURL doMapping(ControllerContext controllerContext, ServerInvocation
invocation, ControllerCommand cmd)
+ {
+ if (cmd == null)
+ {
+ throw new IllegalArgumentException("No null command accepted");
+ }
+ if (cmd instanceof SignOutCommand)
+ {
+ SignOutCommand signOutCommand = (SignOutCommand) cmd;
+
+ //
+ AbstractServerURL asu = new AbstractServerURL();
+ asu.setPortalRequestPath(path);
+ String location = signOutCommand.getLocation();
+ if (location != null)
+ {
+ try
+ {
+ asu.setParameterValue("location", URLEncoder.encode(location,
"UTF-8"));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // ignore
+ }
+ }
+ return asu;
+ }
+ return null;
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+}
+
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-08-10
14:56:56 UTC (rev 7896)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-08-10
15:00:02 UTC (rev 7897)
@@ -775,12 +775,11 @@
proxy-type="attribute">portal:commandFactory=PortalObject</depends>
</mbean>
<mbean
-
code="org.jboss.portal.core.controller.command.mapper.SimpleCommandFactory"
+
code="org.jboss.portal.core.controller.command.mapper.SignOutCommandFactoryService"
name="portal:commandFactory=SignOut"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <attribute
name="CommandClassName">org.jboss.portal.core.controller.command.SignOutCommand</attribute>
</mbean>
<mbean
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
@@ -880,13 +879,12 @@
proxy-type="attribute">portal:service=PortalObjectPathMapper,type=Default</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.controller.command.mapper.SimpleURLFactory"
+ code="org.jboss.portal.core.controller.command.mapper.SignOutURLFactory"
name="portal:urlFactory=SignOut"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<attribute name="Path">/signout</attribute>
- <attribute
name="ClassNames">org.jboss.portal.core.controller.command.SignOutCommand</attribute>
<depends
optional-attribute-name="Factory"
proxy-type="attribute">portal:urlFactory=Delegating</depends>
Modified:
trunk/security/src/main/org/jboss/portal/security/impl/jacc/JACCPortalAuthorizationManager.java
===================================================================
---
trunk/security/src/main/org/jboss/portal/security/impl/jacc/JACCPortalAuthorizationManager.java 2007-08-10
14:56:56 UTC (rev 7896)
+++
trunk/security/src/main/org/jboss/portal/security/impl/jacc/JACCPortalAuthorizationManager.java 2007-08-10
15:00:02 UTC (rev 7897)
@@ -226,7 +226,7 @@
//
if (trace)
{
- log.trace("hasPermission:uri=" + permission.getURI() +
"::action=" + permission.getType() + "::type=" +
permission.getType());
+ log.trace("hasPermission:name=" + permission.getName() +
"uri=" + permission.getURI() + "::actions=" + permission.getActions()
+ "::type=" + permission.getType());
}
//