I'm really puzzled about this, I know there is a couple of duplicate posts like this around, done quite some reading and I know a bit about ClaimsResponse (at least i think i do) working with both SREG and AX information, web.config configuration for enabling AXFetchAsSregTransform, how to use ClaimsRequest to get Google Email with DemandLevel.Require. What i'm trying to do is getting my sample to work (sample used from strathweb) with unified DotNetOpenAuth.dll library after v4.0 as a single reference to my project not a nuget package. Sample works with version DotNetOpenAuth-3.4.7.11121. I would greatly appreciate if anyone could give me some info regarding this problem. All goes well when I am creating request and using DotNetOpenAuth.dll v3.4.7:
public IAuthenticationRequest ValidateAtOpenIdProvider(string openIdIdentifier, Realm realm, Uri returnurl)
{
IAuthenticationRequest openIdRequest = openId.CreateRequest(Identifier.Parse(openIdIdentifier), realm, returnurl);
var fields = new ClaimsRequest() { Email = DemandLevel.Require, FullName = DemandLevel.Require, Nickname = DemandLevel.Require }; openIdRequest.AddExtension(fields); return openIdRequest; }
And redirecting the user to the service provider:
var response = openidemembership.ValidateAtOpenIdProvider(identifier, realm, new Uri("DomainUrl or Localhost/GoogleCallback"));
if (response != null) { return response.RedirectingResponse.AsActionResult(); }
After User is redirected back those 2 methods are called:
public OpenIdUser GetUser() {
OpenIdUser user = null; IAuthenticationResponse openIdResponse = openId.GetResponse(); if (openIdResponse.IsSuccessful()) { user = ResponseIntoUser(openIdResponse); } return user; }
private OpenIdUser ParseResponse(IAuthenticationResponse response) {
OpenIdUser user = null; var claimResponseUntrusted = response.GetUntrustedExtension<ClaimsResponse>(); var claimResponse = response.GetExtension<ClaimsResponse>(); if (claimResponse != null) { user = new OpenIdUser(claimResponse, response.ClaimedIdentifier); } else if (claimResponseUntrusted != null) { user = new OpenIdUser(claimResponseUntrusted, response.ClaimedIdentifier); } return user; }
Inside the controller :
public ActionResult GoogleCallback() {
var user = openidemembership.GetUser(); if (user != null) { //Create cookie and redirect the user back return new RedirectResult(Request.Params["ReturnUrl"] ?? "/"); } return View(); }
Web.Config
<section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true" />
<dotNetOpenAuth>
<openid>
<relyingParty>
<behaviors>
<add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" />
</behaviors>
</relyingParty>
</openid>
</dotNetOpenAuth>
still after using DotNetOpenAuth.dll v4.0 +++, inside ParseResponse method call i can't get any values from ClaimsResponse. And i am using namespace DotNetOpenAuth.OpenId.Extensions.SimpleRegistration. With nuget everything is fine, but is there any other way to get it working with single dll, i really don't wont to add all those references from nuget to my existing project which i am currently working on for one of my customers, thank you in advance.