public YahooAuthenticationResponse ParseAuthenticationResponse(HttpRequest rawRequest) { YahooAuthenticationResponse r = new YahooAuthenticationResponse(); HttpContext context = HttpContext.Current; string return_url = rawRequest.QueryString["openid.return_to"]; /* Since we have added SymT in the return_uri, we need to strip them */ if (return_url.StartsWith(this.Domain)) { string[] urls = return_url.Split('?'); return_url = urls[0]; } if (ValidateSignature(rawRequest)) { r.SymT = rawRequest.QueryString["SymT"]; r.claimed_id = rawRequest.QueryString["openid.claimed_id"]; r.return_to = return_url; } if (string.IsNullOrEmpty(r.claimed_id)) return null; else return r; }
public YahooAuthenticationResponse ParseAuthenticationResponse(HttpRequest rawRequest) { YahooAuthenticationResponse r = new YahooAuthenticationResponse(); HttpContext context = HttpContext.Current; string return_url = rawRequest.QueryString["openid.return_to"]; /* Since we have added SymT in the return_uri, we need to strip them */ if (return_url.StartsWith(this.Domain)) { string[] urls = return_url.Split('?'); return_url = urls[0]; } if (ValidateSignature(rawRequest)) { r.SymT = rawRequest.QueryString["SymT"]; r.claimed_id = rawRequest.QueryString["openid.claimed_id"]; r.return_to = return_url; } if (string.IsNullOrEmpty(r.claimed_id)) { return(null); } else { return(r); } }
protected void Page_Load(object sender, EventArgs e) { string mode = Request.Params["openid.mode"]; if (!String.IsNullOrEmpty(mode)) { if (!expecting_redir) { return; } expecting_redir = false; HttpSessionStateBase sessionBase = new HttpSessionStateWrapper(Session); RP.CurrentSession = sessionBase; YahooAuthenticationResponse resp = RP.ParseAuthenticationResponse(Request); if (resp == null) { return; } notLoggedIn.Visible = false; LoggedIn.Visible = true; if (RP.SignInRP(resp) != null) { logged_id.InnerHtml = String.Format("Your ID is {0}", Request.Params["openid.identity"]); } else { logged_id.InnerHtml = String.Format("Verification Failed"); } } else { notLoggedIn.Visible = true; LoggedIn.Visible = false; } }
protected void LoginBtn_Click(Object sender, EventArgs e) { expecting_redir = true; YahooAuthenticationResponse req = new YahooAuthenticationResponse(); var resp = RP.RequestAuthentication(req); /* HACK for Yahoo IdP */ YahooAuthenticationRequest new_resq = new YahooAuthenticationRequest(); new_resq.claimed_id = resp.claimed_id; new_resq.identity = resp.identity; new_resq.return_to = resp.return_to; new_resq.realm = resp.realm; new_resq.ns = resp.ns; new_resq.mode = resp.mode; CST_Ops.recordme(new OpenID20NameSpace.AuthorizationServerImpl(), resp, new_resq, typeof(AuthorizationServerImpl).GetMethod("SignInIdP"), "yahoo.com", true, false); string final_url = RP.GenerateURL(new_resq); Response.Redirect(final_url); }