I am trying to get openid SSO to work with dotnetopenauth.
I have two separate projects that are debugged separately (both on localhost and on two different ports), one of which acts as a provider, and the other as a relying party.
The assuming side runs on localhost:1903 . The provider runs on localhost:3314 .
Member ID:
public ActionResult Authenticate() { UriBuilder returnToBuilder = new UriBuilder(Request.Url); returnToBuilder.Path = "/OpenId/"; returnToBuilder.Query = null; returnToBuilder.Fragment = null; Uri returnTo = returnToBuilder.Uri; returnToBuilder.Path = "/"; Realm realm = returnToBuilder.Uri; realm = "http://localhost:3314/OpenId/"; returnTo = new Uri("http://localhost:3314/OpenId/"); var response = openid.GetResponse(); if (response == null) { if (Request.QueryString["ReturnUrl"] != null && User.Identity.IsAuthenticated) { } else { string strIdentifier = "testidentifier"; var request = openid.CreateRequest( strIdentifier, realm, returnTo); var fetchRequest = new FetchRequest(); request.AddExtension(fetchRequest); request.RedirectToProvider(); } } else { switch (response.Status) { case AuthenticationStatus.Canceled:
Supplier Code:
public ActionResult Index() { IAuthenticationRequest iR = (IAuthenticationRequest)Request; if (iR.IsReturnUrlDiscoverable(ProviderEndpoint.Provider.Channel.WebRequestHandler) != RelyingPartyDiscoveryResult.Success) { iR.IsAuthenticated = false; return new EmptyResult(); } if (iR.IsDirectedIdentity) { if (User.Identity.IsAuthenticated) { iR.LocalIdentifier = BuildIdentityUrl(); iR.IsAuthenticated = true; } else { if (iR.Immediate || ImplicitAuth) { iR.IsAuthenticated = false; } else { if (!Request.Path.EndsWith("Login", StringComparison.OrdinalIgnoreCase)) { return RedirectToAction("Login", "User"); } } } } else { string userOwningOpenIdUrl = ExtractUserName(iR.LocalIdentifier); iR.IsAuthenticated = userOwningOpenIdUrl == User.Identity.Name; if (!iR.IsAuthenticated.Value && !ImplicitAuth && !iR.Immediate) { if (!Request.Path.EndsWith("Login", StringComparison.OrdinalIgnoreCase)) { return RedirectToAction("Login", "User"); } } } if (iR.IsAuthenticated.Value) { var fetchRequest = iR.GetExtension<FetchRequest>(); if (fetchRequest != null) { var fetchResponse = new FetchResponse();
I get an error when I run relying party code using the openid.CreateRequest method. I have enabled the code debugging of my provider, and it never hits.
Examining the error, I found many suggestions about problems with proxies, but this should not be a problem for me, since I'm only going to localhost.
This may be something pretty obvious, but I don't understand what I'm doing wrong.
Thanks in advance for your help!
EDIT: FYI, I got this code from DotNetOpenAuth samples.
Mansfield
source share