[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/impl/profile/saml1/Ini...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Feb 17 12:32:38 EST 2014
Author: scantor
Date: Mon Feb 17 12:32:38 2014
New Revision: 5389
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5389&view=rev
Log:
Updates to outbound context action and tests.
Modified:
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/InitializeOutboundMessageContext.java
trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/InitializeOutboundMessageContextTest.java
Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/InitializeOutboundMessageContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/InitializeOutboundMessageContext.java?rev=5389&r1=5388&r2=5389&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/InitializeOutboundMessageContext.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/InitializeOutboundMessageContext.java Mon Feb 17 12:32:38 2014
@@ -18,6 +18,7 @@
package net.shibboleth.idp.saml.impl.profile.saml1;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import org.opensaml.core.xml.util.XMLObjectSupport;
import org.opensaml.messaging.context.MessageContext;
@@ -26,7 +27,6 @@
import org.opensaml.profile.action.ActionSupport;
import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
-import org.opensaml.saml.common.SAMLObject;
import org.opensaml.saml.common.binding.SAMLBindingSupport;
import org.opensaml.saml.common.messaging.context.SAMLBindingContext;
import org.opensaml.saml.common.messaging.context.SAMLEndpointContext;
@@ -51,22 +51,33 @@
* @event {@link EventIds#INVALID_MSG_CTX}
*/
// TODO Finish Javadoc.
+// I think this is going to be an OpenSAML action, assuming we're not setting any security related info here.
public class InitializeOutboundMessageContext extends AbstractProfileAction {
/** Class logger. */
- private final Logger log = LoggerFactory.getLogger(InitializeOutboundMessageContext.class);
+ @Nonnull private final Logger log = LoggerFactory.getLogger(InitializeOutboundMessageContext.class);
// TODO Remove autowired credential
/** Test signing credential. */
@Autowired @Qualifier("idp.Credential") private Credential testSigningCredential;
+ /** Inbound {@link SAMLPeerEntityContext}. */
+ @Nullable private SAMLPeerEntityContext inboundPeerEntityCtx;
+
/** {@inheritDoc} */
@Override protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext)
throws ProfileException {
- MessageContext inboundMessageContext = profileRequestContext.getInboundMessageContext();
+ final MessageContext inboundMessageContext = profileRequestContext.getInboundMessageContext();
if (inboundMessageContext == null) {
log.debug("{} No inbound message context", getLogPrefix());
+ ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
+ return false;
+ }
+
+ inboundPeerEntityCtx = inboundMessageContext.getSubcontext(SAMLPeerEntityContext.class, false);
+ if (inboundPeerEntityCtx == null) {
+ log.debug("{} No inbound SAML peer entity context", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
return false;
}
@@ -82,21 +93,22 @@
// TODO Incomplete, see https://wiki.shibboleth.net/confluence/display/IDP30/SAML+1.1+Browser+SSO
- final MessageContext<SAMLObject> msgCtx = new MessageContext<SAMLObject>();
+ final MessageContext msgCtx = new MessageContext();
profileRequestContext.setOutboundMessageContext(msgCtx);
final SAMLPeerEntityContext peerContext = msgCtx.getSubcontext(SAMLPeerEntityContext.class, true);
- peerContext.setEntityId(getPeerEntityId(profileRequestContext));
+ peerContext.setEntityId(inboundPeerEntityCtx.getEntityId());
- SAMLEndpointContext endpointContext = peerContext.getSubcontext(SAMLEndpointContext.class, true);
- // TODO not correct
+ final SAMLBindingContext bindingCtx = msgCtx.getSubcontext(SAMLBindingContext.class, true);
+ bindingCtx.setRelayState(SAMLBindingSupport.getRelayState(profileRequestContext.getInboundMessageContext()));
+
+ // TODO this will be handled by a separate action, leaving for now to keep testbed working
+ final SAMLEndpointContext endpointContext = peerContext.getSubcontext(SAMLEndpointContext.class, true);
endpointContext.setEndpoint(buildSpAcsEndpoint(getBindingURI(profileRequestContext),
"https://sp.example.org/ACSURL"));
+ bindingCtx.setBindingUri(getBindingURI(profileRequestContext));
- final SAMLBindingContext bindingCtx = msgCtx.getSubcontext(SAMLBindingContext.class, true);
[... 130 lines stripped ...]
More information about the commits
mailing list