[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/saml2/profile/delegati...

noreply at shibboleth.net noreply at shibboleth.net
Wed Jun 17 22:33:10 EDT 2015


Author: putmanb
Date: Wed Jun 17 22:33:10 2015
New Revision: 7572

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7572&view=rev
Log:
Introduce strategy and default impl for building/resolving Liberty SSOS endpoint URL from PRC or HttpServletRequest.

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertion.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/LibertyConstants.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertionTest.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertion.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertion.java?rev=7572&r1=7571&r2=7572&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertion.java	(original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/delegation/impl/DecorateDelegatedAssertion.java	Wed Jun 17 22:33:10 2015
@@ -24,12 +24,14 @@
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+import javax.servlet.http.HttpServletRequest;
 
 import net.shibboleth.idp.profile.AbstractProfileAction;
 import net.shibboleth.idp.profile.context.RelyingPartyContext;
 import net.shibboleth.idp.saml.profile.context.navigate.SAMLMetadataContextLookupFunction;
 import net.shibboleth.idp.saml.saml2.profile.config.BrowserSSOProfileConfiguration;
 import net.shibboleth.utilities.java.support.annotation.Prototype;
+import net.shibboleth.utilities.java.support.collection.Pair;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
 import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -125,6 +127,10 @@
     /** The URL at which the IdP will accept Liberty ID-WSF SSOS requests. */
     private String libertySSOSEndpointURL;
     
+    /** The strategy used to resolve the URL at which the IdP will accept Liberty ID-WSF SSOS requests. */
+    @Nullable private Function<Pair<ProfileRequestContext, HttpServletRequest>,String> 
+        libertySSOSEndpointURLLookupStrategy;
+    
     /** Strategy used to lookup the RelyingPartyContext. */
     @Nonnull private Function<ProfileRequestContext,RelyingPartyContext> relyingPartyContextLookupStrategy;
     
@@ -171,6 +177,7 @@
     public DecorateDelegatedAssertion() {
         super();
         
+        libertySSOSEndpointURLLookupStrategy = new LibertySSOSEndpointURLStrategy();
         relyingPartyContextLookupStrategy = new ChildContextLookup<>(RelyingPartyContext.class);
         samlMetadataContextLookupStrategy = new SAMLMetadataContextLookupFunction();
         assertionLookupStrategy = new AssertionStrategy();
@@ -178,14 +185,24 @@
     }
     
     /**
-     * Set the URL at which the IdP will accept Liberty ID-WSF SSOS requests. 
-     * 
-     * @param url the Liberty ID-WSF SSOS endpoint URL
-     */
-    public void setLibertySSOSEndpointURL(@Nonnull final String url) {
+     * Set the statically-configured URL at which the IdP will accept Liberty ID-WSF SSOS requests. 
+     * 
+     * @param url the Liberty ID-WSF SSOS endpoint URL, or null
+     */
+    public void setLibertySSOSEndpointURL(@Nullable final String url) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        libertySSOSEndpointURL = Constraint.isNotNull(StringSupport.trimOrNull(url), 
-                "Liberty SSOS endpoint URL may not be null");
+        libertySSOSEndpointURL = StringSupport.trimOrNull(url);
+    }
+    
+    /**
+     * Set strategy used to resolve the URL at which the IdP will accept Liberty ID-WSF SSOS requests. 
+     * 
+     * @param strategy the Liberty ID-WSF SSOS endpoint URL lookup strategy, or null
+     */
+    public void setLibertySSOSEndpointURLLookupStrategy(
+            @Nullable final Function<Pair<ProfileRequestContext, HttpServletRequest>,String> strategy) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        libertySSOSEndpointURLLookupStrategy = strategy;
     }
     
     /**
@@ -289,14 +306,22 @@
         if (credentialResolver == null) {
             throw new ComponentInitializationException("CredentialResolver may not be null");
         }
-        if (libertySSOSEndpointURL == null) {
-            throw new ComponentInitializationException("Liberty SSOS endpoint URL may not be null");
+        if (libertySSOSEndpointURL == null && libertySSOSEndpointURLLookupStrategy == null) {
+            throw new ComponentInitializationException("Either Liberty SSOS endpoint URL " 
+                    + "or its lookup strategy must be non-null");
         }

[... 222 lines stripped ...]


More information about the commits mailing list