You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2009/05/01 05:39:53 UTC
svn commit: r770524 - in /portals/jetspeed-2/applications/j2-admin/trunk/src:
main/java/org/apache/jetspeed/portlets/sso/ webapp/WEB-INF/security/sso/
Author: taylor
Date: Fri May 1 03:39:53 2009
New Revision: 770524
URL: http://svn.apache.org/viewvc?rev=770524&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-621
https://issues.apache.org/jira/browse/JS2-671
continued testing and improvements on SSO IFrame and WebContent portlets, down to a few issues now.
I have sorted out what was going on with two users having the same remove credentials to a remote site: its not allowed. Improved error handling in this case
Left with a few bugs left in SSO WebContent i want to fix before close 621
Modified:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOIFramePortlet.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOWebContentPortlet.java
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/security/sso/sso-edit-prefs.vm
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOIFramePortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOIFramePortlet.java?rev=770524&r1=770523&r2=770524&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOIFramePortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOIFramePortlet.java Fri May 1 03:39:53 2009
@@ -34,7 +34,9 @@
import org.apache.jetspeed.sso.SSOManager;
import org.apache.jetspeed.sso.SSOSite;
import org.apache.jetspeed.sso.SSOUser;
+import org.apache.portals.applications.gems.browser.StatusMessage;
import org.apache.portals.applications.webcontent.portlet.IFrameGenericPortlet;
+import org.apache.portals.messaging.PortletMessaging;
/**
* SSOIFramePortlet
@@ -103,10 +105,15 @@
}
else
{
- throw new PortletException(e);
- }
+ SSOPortletUtil.publishStatusMessage(request, "SSOIFrame", "status", e, "Could not load Site info for user");
+ }
}
}
+ StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, "SSOIFrame", "status");
+ if (msg != null)
+ {
+ this.getContext(request).put("statusMsg", msg);
+ }
super.doEdit(request, response);
}
@@ -127,7 +134,6 @@
super.doView(request, response);
return;
}
-
try
{
SSOUser remoteUser = SSOPortletUtil.getRemoteUser(sso, request, site);
@@ -154,10 +160,14 @@
}
else
{
- throw new PortletException(e);
+ SSOPortletUtil.publishStatusMessage(request, "SSOIFrame", "status", e, "Could not load Site info for user");
}
}
-
+ StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, "SSOIFrame", "status");
+ if (msg != null)
+ {
+ this.getContext(request).put("statusMsg", msg);
+ }
super.doView(request, response);
}
@@ -190,8 +200,10 @@
}
}
catch (SSOException e)
- {
- throw new PortletException(e);
+ {
+ PortletMessaging.publish(request, "SSOIFrame", "status", new StatusMessage("Could not add remote user: portal principal "+ request.getUserPrincipal().getName() +
+ " is already associated with a remote user for this site!", StatusMessage.ERROR));
+ actionResponse.setPortletMode(PortletMode.EDIT); // stay on edit
}
}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java?rev=770524&r1=770523&r2=770524&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java Fri May 1 03:39:53 2009
@@ -32,6 +32,8 @@
import org.apache.jetspeed.sso.SSOManager;
import org.apache.jetspeed.sso.SSOSite;
import org.apache.jetspeed.sso.SSOUser;
+import org.apache.portals.applications.gems.browser.StatusMessage;
+import org.apache.portals.messaging.PortletMessaging;
/**
@@ -124,4 +126,25 @@
}
return pwc;
}
+
+ public static void publishStatusMessage(PortletRequest request, String portlet, String topic, Throwable e, String message)
+ {
+ String msg = message + ": " + e.toString();
+ Throwable cause = e.getCause();
+ if (cause != null)
+ {
+ msg = msg + ", " + cause.getMessage();
+ }
+ StatusMessage sm = new StatusMessage(msg, StatusMessage.ERROR);
+ try
+ {
+ // TODO: fixme, bug in Pluto on portlet session
+ PortletMessaging.publish(request, portlet, topic, sm);
+ }
+ catch (Exception ee)
+ {
+ System.err.println("Failed to publish message: " + e);
+ }
+ }
+
}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOWebContentPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOWebContentPortlet.java?rev=770524&r1=770523&r2=770524&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOWebContentPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOWebContentPortlet.java Fri May 1 03:39:53 2009
@@ -51,6 +51,7 @@
import org.apache.jetspeed.sso.SSOException;
import org.apache.jetspeed.sso.SSOManager;
import org.apache.jetspeed.sso.SSOSite;
+import org.apache.portals.applications.gems.browser.StatusMessage;
import org.apache.portals.applications.webcontent.portlet.WebContentPortlet;
import org.apache.portals.applications.webcontent.rewriter.WebContentRewriter;
import org.apache.portals.messaging.PortletMessaging;
@@ -193,7 +194,9 @@
}
catch (SSOException e)
{
- throw new PortletException(e);
+ PortletMessaging.publish(actionRequest, "SSOIFrame", "status", new StatusMessage("Could not add remote user: portal principal "+ actionRequest.getUserPrincipal().getName() +
+ " is already associated with a remote user for this site!", StatusMessage.ERROR));
+ actionResponse.setPortletMode(PortletMode.EDIT); // stay on edit
}
}
}
@@ -227,6 +230,11 @@
setupPreferencesEdit(request, response);
}
}
+ StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, "SSOWebContent", "status");
+ if (msg != null)
+ {
+ this.getContext(request).put("statusMsg", msg);
+ }
super.doView(request, response);
}
@@ -248,6 +256,11 @@
getContext(request).put(SSO_EDIT_FIELD_PRINCIPAL, "");
getContext(request).put(SSO_EDIT_FIELD_CREDENTIAL, "");
}
+ StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, "SSOWebContent", "status");
+ if (msg != null)
+ {
+ this.getContext(request).put("statusMsg", msg);
+ }
super.doEdit(request, response);
}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/security/sso/sso-edit-prefs.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/security/sso/sso-edit-prefs.vm?rev=770524&r1=770523&r2=770524&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/security/sso/sso-edit-prefs.vm (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/security/sso/sso-edit-prefs.vm Fri May 1 03:39:53 2009
@@ -1,4 +1,3 @@
-
#*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -29,4 +28,12 @@
<input type="submit" name="Save" value="Save" />
</form>
+#if ($statusMsg)
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+ <div class="$statusMsg.Type">$statusMsg.Text</div>
+</tr>
+</table>
+#end
+
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org