DotNetOpenAuth and X-XRDS-Location Header

I play with DotNetOpenAuth samples, trying to figure out how to integrate correctly with OpenID. One of the samples is called OpenIdRelyingPartyMvc. It has two sections of code, which I'm not sure how they affect functionality.

  • In Global.asax.cs:

    routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = string.Empty }); // Parameter defaults routes.MapRoute( "Root", string.Empty, new { controller = "Home", action = "Index", id = string.Empty }); 

If I delete the last line that displays โ€œRouteโ€, nothing seems to be affected: matching โ€œDefaultโ€ seems sufficient. Why is there a Route Route?

  • In HomeController.cs

     public class HomeController : Controller { public ActionResult Index() { Response.AppendHeader( "X-XRDS-Location", new Uri(Request.Url, Response.ApplyAppPathModifier("~/Home/xrds")).AbsoluteUri); return View("Index"); } public ActionResult Xrds() { return View("Xrds"); } } 

If I remove the call to "AppendHeader" and test the sample, it still works! I understand that this header is enough, I just can not make the sample application depend on it: it works without its configuration. If I set a breakpoint inside the Xrds method, it never starts.

+4
source share
1 answer

The route in global.asax.cs may be redundant.

The X-XRDS-Location header that you delete is not strictly necessary for the OpenID stream, but if you publish an application that relies on it outside of it, Yahoo! and other OpenID providers may warn the user that your site is not legal .

You can test this locally (and thus observe the Home / Xrds action performed) by running the OpenIdProviderWebForms sample and logging into your RP using the identifier from this OP sample. When logging into the system, the OP will request the XRDS RP, and on the web page with a request to confirm the login, it will indicate whether the โ€œRP checkโ€ was successful or unsuccessful. If this works, you should be fine.

+3
source

Source: https://habr.com/ru/post/1393142/


All Articles