[java-identity-provider COMMIT] in /trunk: idp-authn-api/src/main/java/net/shibboleth/idp/authn/ExternalAuthenticatio...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Jun 22 16:42:22 EDT 2015
Author: scantor
Date: Mon Jun 22 16:42:21 2015
New Revision: 7593
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7593&view=rev
Log:
IDP-748 - Accomodate existing query strings in external authn URLs
Modified:
trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/ExternalAuthentication.java
trunk/idp-conf/src/main/resources/system/flows/authn/external-authn-flow.xml
trunk/idp-conf/src/main/resources/system/flows/authn/remoteuser-authn-flow.xml
trunk/idp-conf/src/main/resources/system/flows/authn/x509-authn-flow.xml
Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/ExternalAuthentication.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/ExternalAuthentication.java?rev=7593&r1=7592&r2=7593&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/ExternalAuthentication.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/ExternalAuthentication.java Mon Jun 22 16:42:21 2015
@@ -26,6 +26,8 @@
import org.opensaml.profile.context.ProfileRequestContext;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.net.URISupport;
/** Public interface supporting external authentication outside the webflow engine. */
public class ExternalAuthentication {
@@ -72,6 +74,33 @@
/** Request attribute that provides the entity ID of the relying party that is requesting authentication. */
@Nonnull @NotEmpty public static final String RELYING_PARTY_PARAM = "relyingParty";
+
+ /**
+ * Computes the appropriate location to pass control to to invoke an external authentication mechanism.
+ *
+ * <p>The input location should be suitable for use in a Spring "externalRedirect" expression, and may
+ * contain a query string. The result will include any additional parameters needed to invoke the
+ * mechanism.</p>
+ *
+ * @param baseLocation the base location to build off of
+ * @param conversationValue the value to include as a conversation ID
+ *
+ * @return the computed location
+ *
+ * @since 3.2.0
+ */
+ @Nonnull @NotEmpty public static String getExternalRedirect(@Nonnull @NotEmpty final String baseLocation,
+ @Nonnull @NotEmpty final String conversationValue) {
+ Constraint.isNotEmpty(baseLocation, "Base location cannot be null or empty");
+
+ final StringBuilder url = new StringBuilder(baseLocation);
+
+ // Add a parameter separator for the conversation ID.
+ url.append(baseLocation.indexOf('?') == -1 ? '?' : '&');
+ url.append(CONVERSATION_KEY).append('=').append(URISupport.doURLEncode(conversationValue));
+
+ return url.toString();
+ }
/**
* Initialize a request for external authentication by seeking out the information stored in
Modified: trunk/idp-conf/src/main/resources/system/flows/authn/external-authn-flow.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/system/flows/authn/external-authn-flow.xml?rev=7593&r1=7592&r2=7593&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/system/flows/authn/external-authn-flow.xml (original)
+++ trunk/idp-conf/src/main/resources/system/flows/authn/external-authn-flow.xml Mon Jun 22 16:42:21 2015
@@ -12,7 +12,7 @@
<transition on="proceed" to="ExternalTransfer" />
</action-state>
- <view-state id="ExternalTransfer" view="externalRedirect:#{flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.authn.External.externalAuthnPath')}?conversation=#{flowExecutionContext.getKey().toString()}">
+ <view-state id="ExternalTransfer" view="externalRedirect:#{T(net.shibboleth.idp.authn.ExternalAuthentication).getExternalRedirect(flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.authn.External.externalAuthnPath'), flowExecutionContext.getKey().toString())}">
<on-render>
<evaluate expression="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationContext)).getSubcontext(T(net.shibboleth.idp.authn.context.ExternalAuthenticationContext), true).setFlowExecutionUrl(flowExecutionUrl + '&_eventId_proceed=1')" />
<evaluate expression="externalContext.getNativeRequest().getSession().setAttribute('conversation' + flowExecutionContext.getKey().toString(), new net.shibboleth.idp.authn.impl.ExternalAuthenticationImpl(opensamlProfileRequestContext))" />
Modified: trunk/idp-conf/src/main/resources/system/flows/authn/remoteuser-authn-flow.xml
[... 29 lines stripped ...]
More information about the commits
mailing list