I am trying to develop an OpenID Provider for Single Sign On capability in my company. I have little experience with either MVC 4 or the DotNetOpenAuth
library.
I am trying to build the provider based on the examples downloaded from http://www.dotnetopenauth.net/site.
My provider is not invoked by the relying party but it does not invoke the URI mentioned in the Xdrs. The URI is being formed as
http://localhost:54589/OpenId/provider
but the action for this url (the Provider action) is not being invoked. If I access this URL directly from the browser then it shows the view in the browser.
Below is the Xrds
<?xml version="1.0" encoding="UTF-8"?>
<xrds:XRDS
xmlns:xrds="xri://$xrds"
xmlns:openid="http://openid.net/xmlns/1.0"
xmlns="xri://$xrd*($v*2.0)">
<XRD>
<Service priority="10">
<Type>http://specs.openid.net/auth/2.0/server</Type>
<Type>http://openid.net/extensions/sreg/1.1</Type>
<Type>http://axschema.org/contact/email</Type>
<URI>http://localhost:54589/OpenId/Provider</URI>
</Service>
</XRD>
</xrds:XRDS>
I am not sure whether this is an MVC problem OR I am not using DotNetOpenAuth
correctly.
Update On Debugging I found that my MVC razor Xrds.cshtml is being called but the relying party does not redirect to the URI exist in Xrds. I also made sure that I am setting the Request.ContentType as application/Xrds+xml. Below is my code
public ActionResult Index()
{
if (Request.AcceptTypes.Contains("application/xrds+xml"))
{
ViewData["OPIdentifier"] = true;
return RedirectToAction("Xrds");
}
return View();
}
public ActionResult Xrds()
{
ViewData["OPIdentifier"] = true;
Response.ContentType = "application/xrds+xml";
return View("Xrds");
}
When I see the request and response in Fiddler, it come back with result 200 where it should be 302.
Does this mean that the xrds is not going back to relying party in proper format?
Here the fiddler trace
GET http://localhost:4856/login.aspx?ReturnUrl=%2fMembersOnly%2fDefault.aspx HTTP/1.1
Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://localhost:4856/
Accept-Language: en-GB
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)
Accept-Encoding: gzip, deflate
Host: localhost:4856
Connection: Keep-Alive
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Vary: Accept-Encoding
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcbWFoZXNoLmNoYXVkaGFyaVxEb3dubG9hZHNcRG90TmV0T3BlbkF1dGgtNC4yLjIuMTMwNTVcRG90TmV0T3BlbkF1dGgtNC4yLjIuMTMwNTVcU2FtcGxlc1xPcGVuSWRSZWx5aW5nUGFydHlXZWJGb3Jtc1xsb2dpbi5hc3B4?=
X-Powered-By: ASP.NET
Date: Mon, 11 Mar 2013 08:59:07 GMT
Content-Length: 9430
------------------------------------------------------------------
POST http://localhost:4856/login.aspx?ReturnUrl=%2fMembersOnly%2fDefault.aspx HTTP/1.1
Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://localhost:4856/login.aspx?ReturnUrl=%2fMembersOnly%2fDefault.aspx
Accept-Language: en-GB
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: localhost:4856
Content-Length: 964
Connection: Keep-Alive
Pragma: no-cache
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Vary: Accept-Encoding
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcbWFoZXNoLmNoYXVkaGFyaVxEb3dubG9hZHNcRG90TmV0T3BlbkF1dGgtNC4yLjIuMTMwNTVcRG90TmV0T3BlbkF1dGgtNC4yLjIuMTMwNTVcU2FtcGxlc1xPcGVuSWRSZWx5aW5nUGFydHlXZWJGb3Jtc1xsb2dpbi5hc3B4?=
X-Powered-By: ASP.NET
Date: Mon, 11 Mar 2013 08:59:14 GMT
Content-Length: 10382