Set communication profile before decoding
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / idp / profile / saml2 / SSOProfileHandler.java
index 52e0cc8..0a0aea6 100644 (file)
@@ -115,7 +115,8 @@ public class SSOProfileHandler extends AbstractSAML2ProfileHandler {
                 AuthnContextDeclRef.DEFAULT_ELEMENT_NAME);
         subjectLocalityBuilder = (SAMLObjectBuilder<SubjectLocality>) getBuilderFactory().getBuilder(
                 SubjectLocality.DEFAULT_ELEMENT_NAME);
-        endpointBuilder = (SAMLObjectBuilder<Endpoint>) getBuilderFactory().getBuilder(Endpoint.DEFAULT_ELEMENT_NAME);
+        endpointBuilder = (SAMLObjectBuilder<Endpoint>) getBuilderFactory().getBuilder(
+                AssertionConsumerService.DEFAULT_ELEMENT_NAME);
     }
 
     /** {@inheritDoc} */
@@ -277,6 +278,8 @@ public class SSOProfileHandler extends AbstractSAML2ProfileHandler {
             throws ProfileException {
         log.debug("Decoding message with decoder binding {}", getInboundBinding());
         SSORequestContext requestContext = new SSORequestContext();
+        requestContext.setCommunicationProfileId(getProfileId());
+        
         requestContext.setMetadataProvider(getMetadataProvider());
         requestContext.setSecurityPolicyResolver(getSecurityPolicyResolver());
 
@@ -326,6 +329,7 @@ public class SSOProfileHandler extends AbstractSAML2ProfileHandler {
     protected SSORequestContext buildRequestContext(Saml2LoginContext loginContext, HTTPInTransport in,
             HTTPOutTransport out) throws ProfileException {
         SSORequestContext requestContext = new SSORequestContext();
+        requestContext.setCommunicationProfileId(getProfileId());
 
         requestContext.setMessageDecoder(getMessageDecoders().get(getInboundBinding()));
 
@@ -343,9 +347,7 @@ public class SSOProfileHandler extends AbstractSAML2ProfileHandler {
         requestContext.setPeerEntityId(relyingPartyId);
         requestContext.setInboundMessageIssuer(relyingPartyId);
 
-        populateSAMLMessageInformation(requestContext);
         populateRequestContext(requestContext);
-        populateProfileInformation(requestContext);
 
         return requestContext;
     }
@@ -521,9 +523,8 @@ public class SSOProfileHandler extends AbstractSAML2ProfileHandler {
             if (authnRequest.getProtocolBinding() != null) {
                 endpoint.setBinding(authnRequest.getProtocolBinding());
             } else {
-                endpoint.setBinding(getInboundBinding());
+                endpoint.setBinding(getSupportedOutboundBindings().get(0));
             }
-            endpoint.setBinding(getInboundBinding());
             log.warn("No endpoint available for relying party {}. Generating endpoint with ACS url {} and binding {}",
                     new Object[] { requestContext.getPeerEntityId(), endpoint.getLocation(), endpoint.getBinding() });
         }