protected void Page_Load(object sender, System.EventArgs e) { if (this.Context.Request.IsAuthenticated) { System.Web.Security.FormsAuthentication.SignOut(); System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(HiContext.Current.User.Username, true); IUserCookie userCookie = HiContext.Current.User.GetUserCookie(); if (userCookie != null) { userCookie.DeleteCookie(authCookie); } RoleHelper.SignOut(HiContext.Current.User.Username); } string text = base.Request.QueryString["ot"]; if (OpenIdPlugins.Instance().GetPluginItem(text) == null) { this.lblMsg.Text = "没有找到对应的插件,<a href=\"" + Globals.GetSiteUrls().Home + "\">返回首页</a>。"; return; } OpenIdSettingsInfo openIdSettings = MemberProcessor.GetOpenIdSettings(text); if (openIdSettings == null) { this.lblMsg.Text = "请先配置此插件所需的信息,<a href=\"" + Globals.GetSiteUrls().Home + "\">返回首页</a>。"; return; } string returnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("OpenIdEntry_url", new object[] { text })); OpenIdService openIdService = OpenIdService.CreateInstance(text, HiCryptographer.Decrypt(openIdSettings.Settings), returnUrl); openIdService.Post(); }
private ActionResult OpenIdResponse(IAuthenticationResponse response) { Logger.Trace("Received response from open id provider"); // Step 2: OpenID Provider sending assertion response switch (response.Status) { case AuthenticationStatus.Authenticated: Logger.Info("User succesfully authenticated"); var userId = OpenIdService.ParseResponse(response); var loginResult = this.PerformLoginProcedure(userId); if (!loginResult) { this.ViewBag.Error = "Authentication failed"; return(this.View("Login")); } Logger.Info("Authentication procedure succesfull redirecting to Home/Index"); return(this.RedirectToAction("Index", "Home")); case AuthenticationStatus.Canceled: case AuthenticationStatus.Failed: Logger.Error("Authentication failed : {0}", response.Exception.Message); this.ViewBag.Error = "Authentication failed"; return(this.View("Login")); } return(new EmptyResult()); }
private ActionResult OpenIdRequest(OpenIdRelyingParty openid) { var openIdIdentifier = this.Request.Form["openid_identifier"]; if (openIdIdentifier == TestAccountIdentifier) { return(this.LoginAsTestUser()); } else { Identifier id; if (Identifier.TryParse(openIdIdentifier, out id)) { try { return(OpenIdService.SendRequest(openid, id)); } catch (ProtocolException ex) { Logger.Error("OpenIdRequestError: {0}", ex.Message); this.ViewBag.Error = "Authentication failed"; return(this.View("Login")); } } else { Logger.Error( "Openid_identifier parse error.\r\nThis value should be in the Form Request.\r\nPossible error in View."); this.ViewBag.Error = "Authentication error"; return(this.View("Login")); } } }
protected void Page_Load(object sender, EventArgs e) { string text = base.Request.QueryString["ot"]; PluginItem pluginItem = OpenIdPlugins.Instance().GetPluginItem(text); string text2 = "WapShop"; if (string.IsNullOrEmpty(this.Page.Request.RawUrl)) { goto IL_0049; } goto IL_0049; IL_0049: if (pluginItem == null) { this.lblMsg.Text = "没有找到对应的插件,<a href=\"/\">返回首页</a>。"; } else { OpenIdSettingInfo openIdSettings = MemberProcessor.GetOpenIdSettings(text); if (openIdSettings == null) { this.lblMsg.Text = "请先配置此插件所需的信息,<a href=\"/\">返回首页</a>。"; } else { string returnUrl = Globals.FullPath(base.GetRouteUrl("OpenIdEntry_url", new { HIGW = text.Replace(".", "_") })); OpenIdService openIdService = OpenIdService.CreateInstance(text, HiCryptographer.Decrypt(openIdSettings.Settings), returnUrl); openIdService.Post(); } } }
protected void Page_Load(object sender, EventArgs e) { string text = base.Request.QueryString["ot"]; PluginItem pluginItem = OpenIdPlugins.Instance().GetPluginItem(text); if (pluginItem == null) { this.msg = "没有找到对应的插件,<a href=\"/\">返回首页</a>。"; } else { OpenIdSettingInfo openIdSettings = MemberProcessor.GetOpenIdSettings(text); if (openIdSettings == null) { this.msg = "请先配置此插件所需的信息,<a href=\"/\">返回首页</a>。"; } else { string text2 = base.Request.QueryString["returnUrl"]; string text3 = base.Request.QueryString["client"].ToNullString(); if (string.IsNullOrEmpty(text3)) { text3 = "wapshop"; } string returnUrl = Globals.FullPath(base.GetRouteUrl("OpenIdEntry_url_Wap", new { HIGW = text.Replace(".", "_") })).ToLower().Replace("/wapshop/", "/" + text3 + "/"); OpenIdService openIdService = OpenIdService.CreateInstance(text, HiCryptographer.Decrypt(openIdSettings.Settings), returnUrl); openIdService.Post(); } } }
private ConfigData LoadConfig() { txtSelectedName.Value = openIdType; txtConfigData.Value = ""; ConfigablePlugin plugin = OpenIdService.CreateInstance(openIdType); if (plugin == null) { return(null); } ConfigData configData = plugin.GetConfigData(base.Request.Form); if (configData != null) { txtConfigData.Value = configData.SettingsXml; } return(configData); }
public RecordUserMiddleware(FieldDelegate next, OpenIdService openIdService) { _next = next; _openIdService = openIdService; }