Hi folks,
Sorry to sound like a broken record but I'm having some more problems
getting the user information from a Relaying Party. I understand some
parties are not complying to the schema's/using their own (don't u
love standards?!). Some are not even giving any info out (eg. Yahoo).
With this in mind, I'm sure i'm pretty close to having the right code
to requesting my user info. It used to work before I tried asking for
AX also.
Anyways, here's my request code AND the logging information provided
by the dll (awesome work Andrew, btw). Please take note that there's
an exception in the middle of the logs .. i'm not sure if that is
important. (I think the code is told there's 2 schemas .. tries
version 2.0, fails, falls back to the next one, which is v1.1).
Relaying Party:
myopenid.com
My Code:
ASP.NET MVC c#
private const string MyOpenId_WellKnownAttributes_Contact_Email =
"
http://schema.openid.net/contact/email";
private const string MyOpenId_WellKnownAttributes_Name_Alias = "http://
schema.openid.net/namePerson/friendly";
private const string MyOpenId_WellKnownAttributes_Preferences_Language
= "
http://schema.openid.net/pref/language";
private const string MyOpenId_WellKnownAttributes_Preferences_TimeZone
= "
http://schema.openid.net/pref/timezone";
private const string MyOpenId_WellKnownAttributes_Person_Gender =
"
http://schema.openid.net/person/gender";
public static ActionResult CreateRequest(OpenIdRelyingParty
openId, Identifier identifier)
{
identifier.ThrowIfArgumentIsNull("identifier");
// Define the attributes we wish to be sent.
var fetch = new FetchRequest();
// Official Schema's.
fetch.Attributes.AddRequired
(WellKnownAttributes.Contact.Email);
fetch.Attributes.AddRequired
(WellKnownAttributes.Name.Alias);
fetch.Attributes.AddRequired
(WellKnownAttributes.Preferences.Language);
fetch.Attributes.AddRequired
(WellKnownAttributes.Preferences.TimeZone);
fetch.Attributes.AddRequired
(WellKnownAttributes.Person.Gender);
// MyOpenID.
fetch.Attributes.AddRequired
(MyOpenId_WellKnownAttributes_Contact_Email);
fetch.Attributes.AddRequired
(MyOpenId_WellKnownAttributes_Name_Alias);
fetch.Attributes.AddRequired
(MyOpenId_WellKnownAttributes_Preferences_Language);
fetch.Attributes.AddRequired
(MyOpenId_WellKnownAttributes_Preferences_TimeZone);
fetch.Attributes.AddRequired
(MyOpenId_WellKnownAttributes_Person_Gender);
var request = openId.CreateRequest(identifier.ToString());
request.AddExtension(fetch);
return request.RedirectingResponse.AsActionResult();
}
Logging information:
[Note: I've cleaned up the log info. "WS Info" was originally
"WebDev.WebServer.exe Information".
WS Info: 0 : DotNetOpenAuth, Version=3.1.0.9122, Culture=neutral,
PublicKeyToken=2780ccd10d57b246 (official)
WS Info: 0 : Incoming HTTP request:
http://localhost:6969/Authentication/Authenticate
WS Info: 0 : HTTP GET
http://foobar.myopenid.com/
WS Info: 0 : Total services discovered in HTML: 2
WS Info: 0 : [{
ClaimedIdentifier:
http://foobar.myopenid.com/
ProviderLocalIdentifier:
http://foobar.myopenid.com/
ProviderEndpoint:
http://www.myopenid.com/server
OpenID version: 2.0
Service Type URIs:
http://specs.openid.net/auth/2.0/signon
}, {
ClaimedIdentifier:
http://foobar.myopenid.com/
ProviderLocalIdentifier:
http://foobar.myopenid.com/
ProviderEndpoint:
http://www.myopenid.com/server
OpenID version: 1.1
Service Type URIs:
http://openid.net/signon/1.1
},]
WS Info: 0 : Performing discovery on user-supplied identifier:
http://foobar.myopenid.com/
WS Info: 0 : Creating authentication request for user supplied
Identifier:
http://foobar.myopenid.com/
WS Info: 0 : Preparing to send AssociateDiffieHellmanRequest (2.0)
message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ExtensionsBindingElement did not
apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.BackwardCompatibilityBindingElement
did not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ReturnToNonceBindingElement did
not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ReturnToSignatureBindingElement
did not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement
did not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement did
not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.SigningBindingElement did not
apply to message.
WS Info: 0 : Sending AssociateDiffieHellmanRequest request.
WS Info: 0 : HTTP POST
http://www.myopenid.com/server
WebDev.WebServer.exe Error: 0 : An error occurred while trying to
create an association with
http://www.myopenid.com/server.
DotNetOpenAuth.Messaging.ProtocolException: Error occurred while
sending a direct message or getting the response. --->
System.Net.WebException: The remote server returned an error: (417)
Expectation failed.
at System.Net.HttpWebRequest.GetResponse()
at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse
(HttpWebRequest request, DirectWebRequestOptions options)
--- End of inner exception stack trace ---
at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse
(HttpWebRequest request, DirectWebRequestOptions options)
at DotNetOpenAuth.Messaging.UntrustedWebRequestHandler.GetResponse
(HttpWebRequest request, DirectWebRequestOptions options)
at
DotNetOpenAuth.OpenId.ChannelElements.OpenIdChannel.GetDirectResponse
(HttpWebRequest webRequest)
at DotNetOpenAuth.Messaging.Channel.RequestCore
(IDirectedProtocolMessage request)
at DotNetOpenAuth.Messaging.Channel.Request
(IDirectedProtocolMessage requestMessage)
at
DotNetOpenAuth.OpenId.RelyingParty.AssociationManager.CreateNewAssociation
(ProviderEndpointDescription provider, AssociateRequest
associateRequest, Int32 retriesRemaining)
WebDev.WebServer.exe Warning: 0 : Failed to create association with
http://www.myopenid.com/server. Skipping to next endpoint.
WS Info: 0 : Creating authentication request for user supplied
Identifier:
http://foobar.myopenid.com/
WS Info: 0 : Preparing to send AssociateDiffieHellmanRequest (1.1)
message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ExtensionsBindingElement did not
apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.BackwardCompatibilityBindingElement
did not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ReturnToNonceBindingElement did
not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ReturnToSignatureBindingElement
did not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement
did not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement did
not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.SigningBindingElement did not
apply to message.
WS Info: 0 : Sending AssociateDiffieHellmanRequest request.
WS Info: 0 : HTTP POST
http://www.myopenid.com/server
WS Info: 0 : Received AssociateDiffieHellmanResponse response.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ReturnToSignatureBindingElement
did not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.BackwardCompatibilityBindingElement
did not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.SigningBindingElement did not
apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement did
not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement
did not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ReturnToNonceBindingElement did
not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ExtensionsBindingElement did not
apply to message.
WS Info: 0 : Preparing to send CheckIdRequest (1.1) message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ExtensionsBindingElement applied
to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.BackwardCompatibilityBindingElement
applied to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ReturnToNonceBindingElement
applied to message.
WS Info: 0 : ReturnTo signed data:
dnoi.claimed_id:
http://foobar.myopenid.com/
dnoi.op_endpoint:
http://www.myopenid.com/server
dnoi.request_nonce: Z8OzFMy6ywhwIS53RrH1Sey0NJF+MJoC
dnoi.return_to_sig_handle: {633805558259146666}{5BNwYQ==}
dnoi.userSuppliedIdentifier:
http://foobar.myopenid.com/
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.ReturnToSignatureBindingElement
applied to message.
WS Info: 0 : Binding element
DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement
did not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement did
not apply to message.
WS Info: 0 : Binding element
DotNetOpenAuth.OpenId.ChannelElements.SigningBindingElement did not
apply to message.
WS Info: 0 : Sending message: CheckIdRequest
WS Info: 0 : Redirecting to
http://www.myopenid.com/server?openid.identity=http%3a%2f%2ffoobar.myopenid.com%2f&openid.assoc_handle=%7bHMAC-SHA1%7d%7b4a34912b%7d%7brZb9LQ%3d%3d%7d&openid.return_to=http%3a%2f%2flocalhost%3a6969%2fAuthentication%2fAuthenticate%3fdnoi.userSuppliedIdentifier%3dhttp%253a%252f%252ffoobar.myopenid.com%252f%26dnoi.op_endpoint%3dhttp%253a%252f%252fwww.myopenid.com%252fserver%26dnoi.claimed_id%3dhttp%253a%252f%252ffoobar.myopenid.com%252f%26dnoi.request_nonce%3dZ8OzFMy6ywhwIS53RrH1Sey0NJF%252bMJoC%26dnoi.return_to_sig_handle%3d%257b633805558259146666%257d%257b5BNwYQ%253d%253d%257d%26dnoi.return_to_sig%3dO0Ow6ur7fy4eDP%252bFpYXTwOSbZkPJP6d3qOxmhG41s4pnaYos6tiHPjEecp7BugDySaTZiUdajNy%252frVoKubLgoA%253d%253d&openid.trust_root=http%3a%2f%2flocalhost%3a6969%2f&openid.mode=checkid_setup&openid.ns.alias3=http%3a%2f%2fopenid.net%2fsrv%2fax%2f1.0&openid.alias3.required=alias1%2calias2%2calias3%2calias4%2calias5%2calias6%2calias7%2calias8%2calias9%2calias10&openid.alias3.mode=fetch_request&openid.alias3.type.alias1=http%3a%2f%2faxschema.org%2fcontact%2femail&openid.alias3.count.alias1=1&openid.alias3.type.alias2=http%3a%2f%2faxschema.org%2fnamePerson%2ffriendly&openid.alias3.count.alias2=1&openid.alias3.type.alias3=http%3a%2f%2faxschema.org%2fpref%2flanguage&openid.alias3.count.alias3=1&openid.alias3.type.alias4=http%3a%2f%2faxschema.org%2fpref%2ftimezone&openid.alias3.count.alias4=1&openid.alias3.type.alias5=http%3a%2f%2faxschema.org%2fperson%2fgender&openid.alias3.count.alias5=1&openid.alias3.type.alias6=http%3a%2f%2fschema.openid.net%2fcontact%2femail&openid.alias3.count.alias6=1&openid.alias3.type.alias7=http%3a%2f%2fschema.openid.net%2fnamePerson%2ffriendly&openid.alias3.count.alias7=1&openid.alias3.type.alias8=http%3a%2f%2fschema.openid.net%2fpref%2flanguage&openid.alias3.count.alias8=1&openid.alias3.type.alias9=http%3a%2f%2fschema.openid.net%2fpref%2ftimezone&openid.alias3.count.alias9=1&openid.alias3.type.alias10=http%3a%2f%2fschema.openid.net%2fperson%2fgender&openid.alias3.count.alias10=1
The thread 0xeb0 has exited with code 0 (0x0).
----------
Should i be ditching this code and doing some sreg instead? (I'm
trying to have some request code that sorta handles most main RP's).
Thanks for any help or suggestions.
-Justin-