[java-identity-provider COMMIT] in /trunk: idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java idp...

noreply at shibboleth.net noreply at shibboleth.net
Tue Jul 17 13:14:35 EDT 2012


Author: lajoie
Date: Tue Jul 17 13:14:35 2012
New Revision: 4206

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4206&view=rev
Log:
Clean up relying party configuration resolution stage

Modified:
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/AddRelyingPartyConfigurationToProfileRequestContext.java

Modified: trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java?rev=4206&r1=4205&r2=4206&view=diff
==============================================================================
--- trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java (original)
+++ trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java Tue Jul 17 13:14:35 2012
@@ -39,6 +39,12 @@
     public static final String NO_RELYING_PARTY_CTX = "NoRelyingPartyContext";
 
     /**
+     * ID of the event returned if no {@link net.shibboleth.idp.relyingparty.RelyingPartyConfiguration} is associated
+     * with the {@link net.shibboleth.idp.profile.ProfileRequestContext}.
+     */
+    public static final String NO_RELYING_PARTY_CONFIG = "NoRelyingPartyConfiguration";
+
+    /**
      * ID of the event returned if no {@link net.shibboleth.idp.attribute.AttributeContext} is associated with the
      * {@link net.shibboleth.idp.relyingparty.RelyingPartyContext}.
      */

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/AddRelyingPartyConfigurationToProfileRequestContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/AddRelyingPartyConfigurationToProfileRequestContext.java?rev=4206&r1=4205&r2=4206&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/AddRelyingPartyConfigurationToProfileRequestContext.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/AddRelyingPartyConfigurationToProfileRequestContext.java Tue Jul 17 13:14:35 2012
@@ -18,11 +18,15 @@
 package net.shibboleth.idp.saml.impl.profile;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import net.shibboleth.ext.spring.webflow.Event;
+import net.shibboleth.ext.spring.webflow.Events;
 import net.shibboleth.idp.profile.AbstractProfileAction;
 import net.shibboleth.idp.profile.ActionSupport;
+import net.shibboleth.idp.profile.EventIds;
 import net.shibboleth.idp.profile.ProfileException;
 import net.shibboleth.idp.profile.ProfileRequestContext;
 import net.shibboleth.idp.relyingparty.RelyingPartyConfiguration;
@@ -35,15 +39,19 @@
 import org.opensaml.messaging.context.navigate.ChildContextLookup;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.webflow.execution.Event;
 import org.springframework.webflow.execution.RequestContext;
 
 import com.google.common.base.Function;
 
 /**
  * This action attempts to resolve a {@link RelyingPartyConfiguration} and adds it to the {@link RelyingPartyContext}
- * located on the {@link ProfileRequestContext}.
+ * that was looked up.
  */
+ at Events({
+        @Event(id = EventIds.PROCEED_EVENT_ID),
+        @Event(id = EventIds.NO_RELYING_PARTY_CTX, description = "No relying party context return by lookup strategy"),
+        @Event(id = EventIds.NO_RELYING_PARTY_CONFIG,
+                description = "No relying party configuation can be associated with the profile request")})
 public final class AddRelyingPartyConfigurationToProfileRequestContext extends AbstractProfileAction {
 
     /** Class logger. */
@@ -108,67 +116,29 @@
     }
 
     /** {@inheritDoc} */
-    public Event doExecute(final HttpServletRequest httpRequest, final HttpServletResponse httpResponse,
-            final RequestContext springRequestContext, final ProfileRequestContext profileRequestContext)
-            throws ProfileException {
+    public org.springframework.webflow.execution.Event doExecute(@Nullable final HttpServletRequest httpRequest,
+            @Nullable final HttpServletResponse httpResponse, @Nullable final RequestContext springRequestContext,
+            @Nonnull final ProfileRequestContext profileRequestContext) throws ProfileException {
 
         final RelyingPartyContext relyingPartyCtx = relyingPartyContextLookupStrategy.apply(profileRequestContext);
+        if (relyingPartyCtx == null) {
+            log.debug("Action {}: No relying party context available for this request", getId());
+            return ActionSupport.buildEvent(this, EventIds.NO_RELYING_PARTY_CTX);
+        }
 
         try {
             final RelyingPartyConfiguration config = rpConfigResolver.resolveSingle(profileRequestContext);
             if (config == null) {

[... 60 lines stripped ...]


More information about the commits mailing list