<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 12/12/12 12:43 PM, Mitu Singh wrote:<br>
</div>
<blockquote
cite="mid:1355334239.65608.YahooMailNeo@web122005.mail.ne1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:tahoma,
new york, times, serif;font-size:10pt">
<div style="font-family: tahoma, new york, times, serif;
font-size: 10pt;">
<div style="font-family: times new roman, new york, times,
serif; font-size: 12pt;">
<div id="yiv213462049">
<div>
<div
style="color:#000;background-color:#fff;font-family:tahoma,
new york, times, serif;font-size:10pt;">
<div style="font-family:tahoma, new york, times,
serif;font-size:10pt;">
<div style="font-family:times new roman, new york,
times, serif;font-size:12pt;">
<div id="yiv213462049">
<div>
<div
style="color:#000;background-color:#fff;font-family:tahoma,
new york, times, serif;font-size:10pt;"><br>
<div class="yiv213462049MsoNormal">I have
tried a number of ways to include the
header, but it
is not being set. This is how I have done
it:<span class="yiv213462049tab"> </span><span
class="yiv213462049tab"> </span><span
class="yiv213462049tab"> </span><span
class="yiv213462049tab"> </span>
<div class="yiv213462049MsoNormal"><span
class="yiv213462049tab"> </span><span
class="yiv213462049tab"> </span><span
class="yiv213462049tab"> </span><span
class="yiv213462049tab"> </span><span
class="yiv213462049tab"> </span><span
style="color:#4F81BD;">HttpServletResponseAdapter
outTransport
= new
HttpServletResponseAdapter(httpResponse,
false);</span> <br>
</div>
</div>
<div class="yiv213462049MsoNormal"
style="margin-left:.5in;text-indent:.5in;"><u><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">BasicSAMLMessageContext</span></u><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
messageContext = <b>new</b>
<u>BasicSAMLMessageContext</u>();</span><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
</span>
</div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
messageContext.setOutboundMessageTransport(outTransport);</span><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
</span>
</div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
SOAPObjectBuilder<Envelope>
envelopeBuilder =
(SOAPObjectBuilder<Envelope>)
builderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME);</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
Envelope envelope =
envelopeBuilder.buildObject(); </span></div>
<span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;"> </span>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;"> messageContext.setOutboundMessage(envelope);
</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;"> messageContext.setOutboundSAMLMessage(authResponse);</span><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
</span>
</div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
SAMLObjectBuilder<org.opensaml.saml2.ecp.Response>
ecpResponseBuilder =
(SAMLObjectBuilder<org.opensaml.saml2.ecp.Response>)
builderFactory.getBuilder(org.opensaml.saml2.ecp.Response.DEFAULT_ELEMENT_NAME);</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
org.opensaml.saml2.ecp.Response
ecpResponse =
ecpResponseBuilder.buildObject();</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
ecpResponse.setSOAP11MustUnderstand(true);</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
ecpResponse.setSOAP11Actor(org.opensaml.saml2.ecp.Response.SOAP11_ACTOR_NEXT);</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
ecpResponse.setAssertionConsumerServiceURL("<a moz-do-not-send="true"
rel="nofollow" target="_blank"
href="https://localhost:8443/spring-security-saml2-sample">https://localhost:8443/sp_URL</a>");
</span></div>
<div class="yiv213462049MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;">
SOAPHelper.addHeaderBlock(messageContext,
ecpResponse);</span></div>
<div class="yiv213462049MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas;color:#4F81BD;"> </span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
Off-hand, this approach looks more or less correct, at least in
broad strokes. But since it isn't working, there must be something
subtly wrong. I have to run out the door soon, but I will later try
and take a closer look and see if I can spot what it is.<br>
<br>
<br>
<blockquote
cite="mid:1355334239.65608.YahooMailNeo@web122005.mail.ne1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:tahoma,
new york, times, serif;font-size:10pt">
<div style="font-family: tahoma, new york, times, serif;
font-size: 10pt;">
<div style="font-family: times new roman, new york, times,
serif; font-size: 12pt;">
<div id="yiv213462049">
<div>
<div
style="color:#000;background-color:#fff;font-family:tahoma,
new york, times, serif;font-size:10pt;">
<div style="font-family:tahoma, new york, times,
serif;font-size:10pt;">
<div style="font-family:times new roman, new york,
times, serif;font-size:12pt;">
<div id="yiv213462049">
<div>
<div
style="color:#000;background-color:#fff;font-family:tahoma,
new york, times, serif;font-size:10pt;">
<div class="yiv213462049MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas;">And
another
way:</span></div>
<div class="yiv213462049MsoNormal"
style="text-indent:.5in;"><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">SOAPObjectBuilder<Envelope>
envelopeBuilder
= <u>(SOAPObjectBuilder<Envelope>)
builderFactory.getBuilder(Envelope.<i>DEFAULT_ELEMENT_NAME</i>)</u>;</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
Envelope envelope =
envelopeBuilder.buildObject();
</span></div>
<span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
</span>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;"> SOAPObjectBuilder<Header>
headerBuilder
= <u>(SOAPObjectBuilder<Header>)
builderFactory.getBuilder(Header.<i>DEFAULT_ELEMENT_NAME</i>)</u>;</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
Header header =
headerBuilder.buildObject(); </span></div>
<span
style="font-size:10.0pt;font-family:Consolas;color:#953735;"> </span>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;"> SAMLObjectBuilder<org.opensaml.saml2.ecp.Response>
ecpResponseBuilder
= <u>(SAMLObjectBuilder<org.opensaml.saml2.ecp.Response>)
builderFactory.getBuilder(org.opensaml.saml2.ecp.Response.<i>DEFAULT_ELEMENT_NAME</i>)</u>;</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
org.opensaml.saml2.ecp.Response
ecpResponse =
ecpResponseBuilder.buildObject();</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
ecpResponse.setSOAP11MustUnderstand(<b>true</b>);</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
ecpResponse.setSOAP11Actor(org.opensaml.saml2.ecp.Response.<i>SOAP11_ACTOR_NEXT</i>);</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
ecpResponse.setAssertionConsumerServiceURL("<a moz-do-not-send="true"
rel="nofollow" target="_blank"
href="https://localhost:8443/spring-security-saml2-sample">https://localhost:8443/sp</a>");</span><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
</span>
</div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
header.getUnknownXMLObjects().add(ecpResponse);</span></div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
envelope.setHeader(header);</span><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;"> </span>
</div>
<div class="yiv213462049MsoNormal" style=""><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;"> <span
style="background:yellow;">messageContext</span>.setOutboundMessage(envelope);</span></div>
<div class="yiv213462049MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas;color:#953735;">
<u><span style="background:yellow;">messageContext</span>.setOutboundSAMLMessage(authResponse)</u>;
</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<br>
<br>
This also looks off-hand correct, but again there must be some
trivial thing that is being omitted or something (or possibly we
have a bug somewhere.<br>
<br>
</body>
</html>