Last active
August 29, 2015 13:55
-
-
Save xdumaine/8689945 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static OpenIdRelyingParty openId = new OpenIdRelyingParty(); | |
[HttpPost] | |
public ActionResult OpenId(string identifier) | |
{ | |
if (!Identifier.IsValid(identifier)) | |
{ | |
ModelState.AddModelError("loginIdentifier", | |
"The specified login identifier is invalid"); | |
return RedirectToAction("Index"); | |
} | |
//// use these to validate the connection to the OpenId provider | |
//var r = (HttpWebRequest)WebRequest.Create(identifier); | |
//var httpRes = (HttpWebResponse)r.GetResponse(); | |
var openIdIdentifier = Identifier.Parse(identifier); | |
var request = openId.CreateRequest(openIdIdentifier); | |
// Require some additional data | |
var claimsRequest = new ClaimsRequest { Email = DemandLevel.Require }; | |
request.Mode = AuthenticationRequestMode.Setup; | |
request.AddExtension(claimsRequest); | |
return request.RedirectingResponse.AsActionResult(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment