Browser Post - ConsumeResponse query

"killian davies" <[email protected]> Thu, 14 Apr 2005 10:20:39 +0100
Newsgroups gmane.comp.sourceid.sso.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.

--===============1525032334==
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0006_01C540DB.9BBE1B70"

This is a multi-part message in MIME format.

------=_NextPart_000_0006_01C540DB.9BBE1B70
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Hi,

I have been using the .NET implementation.

I have had a problem with the following the "ConsumeResponse" method of the
AutnRequestor class (using browser post).

The validation of the signature in the response (authentication response)
was always returning true because "response_doc["Signature",
SignedXml.XmlDsigNamespaceUrl]" was always returning null - the XPath expr
wasn't matching it.

I changed to use the XmlNamespaceManager with all relevant namespaces added
and this does now locate the Signature element.

It is currently attempting to verify the sig but I'm always getting false
back (possibly because i have updated my project to use WSE2 (bad idea - not
b'ward compatible with WSE1) - am not sure that this is the reason?)

Thanks,

Killian

 

validate sig (if present)

// This wasnt locating the element

//if (response_doc["Signature", SignedXml.XmlDsigNamespaceUrl] != null)

 // So changed to ...

XmlNamespaceManager xmln = new XmlNamespaceManager(response_doc.NameTable);

xmln.AddNamespace("","http://projectliberty.org/schemas/core/2002/12");

xmln.AddNamespace("xlmdsig",SignedXml.XmlDsigNamespaceUrl);

if (response_doc.SelectSingleNode("//xlmdsig:Signature",xmln) != null)

{

sig_check = XmlUtils.VerifyResponse

(response_doc.DocumentElement, 

(AsymmetricAlgorithm)dir.FindIdpKey(provider_id));

}

else

{

// was always going in here

sig_check = true;

}

 

 

 


------=_NextPart_000_0006_01C540DB.9BBE1B70
Content-Type: text/html;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
p
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman";}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt'>Hi,<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>I =
have been using
the .NET implementation.<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>I =
have had a
problem with the following the &quot;ConsumeResponse&quot; method of the
AutnRequestor class (using browser post).<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>The =
validation of
the signature in the response (authentication response) was always =
returning
true because &quot;<font color=3Dgreen><span =
style=3D'color:green'>response_doc[&quot;Signature&quot;,
SignedXml.XmlDsigNamespaceUrl]&quot; was always returning null - the =
XPath expr
wasn't matching it.</span></font><o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;
color:green'>I changed to use the XmlNamespaceManager&nbsp;with&nbsp;all
relevant&nbsp;namespaces added and this does now&nbsp;locate&nbsp;the =
Signature
element.</span></font><o:p></o:p></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;
color:green'>It is currently attempting to verify the sig but I'm always =
getting
false back (possibly because i have updated my project to use WSE2 (bad =
idea -
not b'ward compatible with WSE1) &#8211; am not sure that this is the =
reason?)<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;
color:green'>Thanks,<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;
color:green'>Killian<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;
color:green'><o:p>&nbsp;</o:p></span></font></p>

<p><font size=3D2 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt;
color:green'>validate sig (if present)</span></font><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p=
>

<p><font size=3D2 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt;
color:green'>// This wasnt locating the element</span></font><font =
size=3D2
face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p=
>

<p><font size=3D2 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt;
color:green'>//if (response_doc[&quot;Signature&quot;,
SignedXml.XmlDsigNamespaceUrl] !=3D null)</span></font><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p=
>

<p><font size=3D2 color=3Dblack face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt;
color:black'>&nbsp;// So changed to ...</span></font><font size=3D2 =
color=3Dgreen
face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial;color:green'><o:p></o:p></spa=
n></font></p>

<p><font size=3D2 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt;
color:green'>XmlNamespaceManager xmln =3D </span></font><font size=3D2 =
color=3Dblue
face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial;color:blue'>new</span></font>=
<font
size=3D2 color=3Dgreen face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial;
color:green'> =
XmlNamespaceManager(response_doc.NameTable);<o:p></o:p></span></font></p>=


<p><font size=3D2 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt;
color:green'>xmln.AddNamespace(&quot;&quot;,&quot;http://projectliberty.o=
rg/schemas/core/2002/12&quot;);<o:p></o:p></span></font></p>

<p><font size=3D2 color=3Dgreen face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt;
color:green'>xmln.AddNamespace(&quot;xlmdsig&quot;,SignedXml.XmlDsigNames=
paceUrl);<o:p></o:p></span></font></p>

<p><font size=3D2 color=3Dblue face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt;
color:blue'>if</span></font><font size=3D2 face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial'>
(response_doc.SelectSingleNode(&quot;//xlmdsig:Signature&quot;,xmln) =
!=3D <font
color=3Dblue><span =
style=3D'color:blue'>null</span></font>)<o:p></o:p></span></font></p>

<p><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt'>{<o:p></o:p></span></font></p>

<p><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt'>sig_check
=3D XmlUtils.VerifyResponse<o:p></o:p></span></font></p>

<p><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt'>(response_doc.DocumentElement,
<o:p></o:p></span></font></p>

<p><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt'>(AsymmetricAlgorithm)dir.FindIdpKey(provider_i=
d));<o:p></o:p></span></font></p>

<p><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt'>}<o:p></o:p></span></font></p>

<p><font size=3D2 color=3Dblue face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt;
color:blue'>else<o:p></o:p></span></font></p>

<p><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt'>{<o:p></o:p></span></font></p>

<p><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt'>// was
always going in here<o:p></o:p></span></font></p>

<p><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt'>sig_check
=3D <font color=3Dblue><span =
style=3D'color:blue'>true</span></font>;<o:p></o:p></span></font></p>

<p><font size=3D2 face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt'>}<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>

------=_NextPart_000_0006_01C540DB.9BBE1B70--


--===============1525032334==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
sso-users mailing list
[email protected]
http://lists.sourceid.org/mailman/listinfo/sso-users

--===============1525032334==--