diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-10-28 07:26:43 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-10-28 07:26:43 -0700 |
commit | b7be3ad9d93effda4c40128dff2cb819f552ca90 (patch) | |
tree | 7bf998e541c19cd43e7b6e582535ead573065f4c /projecttemplates/WebFormsRelyingParty | |
parent | 3174dc3dcb8d21d17a6216ad97014b9840e76c30 (diff) | |
download | DotNetOpenAuth-b7be3ad9d93effda4c40128dff2cb819f552ca90.zip DotNetOpenAuth-b7be3ad9d93effda4c40128dff2cb819f552ca90.tar.gz DotNetOpenAuth-b7be3ad9d93effda4c40128dff2cb819f552ca90.tar.bz2 |
Lots of StyleCop fixes.
Diffstat (limited to 'projecttemplates/WebFormsRelyingParty')
-rw-r--r-- | projecttemplates/WebFormsRelyingParty/Admin/Default.aspx.cs | 4 | ||||
-rw-r--r-- | projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs | 63 |
2 files changed, 34 insertions, 33 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/Admin/Default.aspx.cs b/projecttemplates/WebFormsRelyingParty/Admin/Default.aspx.cs index 9e45e45..cc9abf1 100644 --- a/projecttemplates/WebFormsRelyingParty/Admin/Default.aspx.cs +++ b/projecttemplates/WebFormsRelyingParty/Admin/Default.aspx.cs @@ -17,8 +17,8 @@ namespace WebFormsRelyingParty.Admin { public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { - usersRepeater.DataSource = Global.DataContext.User.Include("AuthenticationTokens"); - usersRepeater.DataBind(); + this.usersRepeater.DataSource = Global.DataContext.User.Include("AuthenticationTokens"); + this.usersRepeater.DataBind(); } } } diff --git a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs index a04abcf..66ba529 100644 --- a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs +++ b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs @@ -1,26 +1,27 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using DotNetOpenAuth.InfoCard; -using DotNetOpenAuth.Messaging; -using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; -using DotNetOpenAuth.OpenId.RelyingParty; +namespace WebFormsRelyingParty { + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Web; + using System.Web.Security; + using System.Web.UI; + using System.Web.UI.WebControls; + using DotNetOpenAuth.InfoCard; + using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; + using DotNetOpenAuth.OpenId.RelyingParty; -namespace WebFormsRelyingParty { public partial class LoginFrame : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Because this page can appear as an iframe in a popup of another page, // we need to record which page the hosting page is in order to redirect back // to it after login is complete. - this.ClientScript.RegisterOnSubmitStatement(this.GetType(), "getTopWindowUrl", @" -document.getElementById('topWindowUrl').value = window.parent.location.href; -"); + this.ClientScript.RegisterOnSubmitStatement( + this.GetType(), + "getTopWindowUrl", + "document.getElementById('topWindowUrl').value = window.parent.location.href;"); } } @@ -32,6 +33,18 @@ document.getElementById('topWindowUrl').value = window.parent.location.href; this.LoginUser(AuthenticationToken.SynthesizeClaimedIdentifierFromInfoCard(e.Token.UniqueId), e.Token.SiteSpecificId, null); } + protected void openIdButtonPanel_Failed(object sender, OpenIdEventArgs e) { + if (e.Response.Exception != null) { + errorMessageLabel.Text = e.Response.Exception.Message; + } + this.errorPanel.Visible = true; + } + + protected void openIdButtonPanel_TokenProcessingError(object sender, TokenProcessingErrorEventArgs e) { + this.errorMessageLabel.Text = e.Exception.Message; + this.errorPanel.Visible = true; + } + private void LoginUser(string claimedIdentifier, string friendlyIdentifier, ClaimsResponse claims) { // Create an account for this user if we don't already have one. AuthenticationToken openidToken = Global.DataContext.AuthenticationToken.FirstOrDefault(token => token.ClaimedIdentifier == claimedIdentifier); @@ -65,11 +78,11 @@ document.getElementById('topWindowUrl').value = window.parent.location.href; bool persistentCookie = false; if (string.IsNullOrEmpty(this.Request.QueryString["ReturnUrl"])) { FormsAuthentication.SetAuthCookie(openidToken.ClaimedIdentifier, persistentCookie); - if (!string.IsNullOrEmpty(topWindowUrl.Value)) { - Uri topWindowUri = new Uri(topWindowUrl.Value); + if (!string.IsNullOrEmpty(this.topWindowUrl.Value)) { + Uri topWindowUri = new Uri(this.topWindowUrl.Value); string returnUrl = HttpUtility.ParseQueryString(topWindowUri.Query)["ReturnUrl"]; if (string.IsNullOrEmpty(returnUrl)) { - Response.Redirect(topWindowUrl.Value); + Response.Redirect(this.topWindowUrl.Value); } else { Response.Redirect(returnUrl); } @@ -81,17 +94,5 @@ document.getElementById('topWindowUrl').value = window.parent.location.href; FormsAuthentication.RedirectFromLoginPage(openidToken.ClaimedIdentifier, persistentCookie); } } - - protected void openIdButtonPanel_Failed(object sender, OpenIdEventArgs e) { - if (e.Response.Exception != null) { - errorMessageLabel.Text = e.Response.Exception.Message; - } - errorPanel.Visible = true; - } - - protected void openIdButtonPanel_TokenProcessingError(object sender, TokenProcessingErrorEventArgs e) { - errorMessageLabel.Text = e.Exception.Message; - errorPanel.Visible = true; - } } } |