summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-11-13 08:11:31 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2009-11-13 08:11:31 -0800
commit8d5d54d260d071e07c5d6e4eeedc90f8641d19dd (patch)
treead9adf68cab33575c62e0d5b492e2edc4521e47e
parent0df47706d21de26d89a3353890a867123ca4d289 (diff)
downloadDotNetOpenAuth-8d5d54d260d071e07c5d6e4eeedc90f8641d19dd.zip
DotNetOpenAuth-8d5d54d260d071e07c5d6e4eeedc90f8641d19dd.tar.gz
DotNetOpenAuth-8d5d54d260d071e07c5d6e4eeedc90f8641d19dd.tar.bz2
UI touch-ups and StyleCop fixes.
-rw-r--r--projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx28
-rw-r--r--projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs24
-rw-r--r--projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.designer.cs27
-rw-r--r--projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx34
-rw-r--r--projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs8
5 files changed, 109 insertions, 12 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx b/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx
index 5ed0745..b6066b7 100644
--- a/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx
+++ b/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx
@@ -75,6 +75,34 @@
<asp:AsyncPostBackTrigger ControlID="saveChanges" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
+ <asp:UpdatePanel runat="server" ID="authorizedClientsPanel" ChildrenAsTriggers="true">
+ <ContentTemplate>
+ <h3>
+ Authorized clients
+ </h3>
+ <asp:Panel runat="server" ID="noAuthorizedClientsPanel" Visible="false">
+ You have not authorized any clients to access your data.
+ </asp:Panel>
+ <asp:Repeater runat="server" ID="tokenListRepeater">
+ <HeaderTemplate>
+ <ul>
+ </HeaderTemplate>
+ <ItemTemplate>
+ <li>
+ <asp:Label runat="server" Text='<%# Eval("Consumer.Name") %>' />
+ -
+ <asp:Label ID="Label1" runat="server" Text='<%# Eval("CreatedOn") %>' ForeColor="Gray" />
+ -
+ <asp:LinkButton ID="revokeLink" runat="server" Text="revoke" OnCommand="revokeToken_Command"
+ CommandName="revokeToken" CommandArgument='<%# Eval("Token") %>' />
+ </li>
+ </ItemTemplate>
+ <FooterTemplate>
+ </ul>
+ </FooterTemplate>
+ </asp:Repeater>
+ </ContentTemplate>
+ </asp:UpdatePanel>
<h3>
OpenIDs &amp; InfoCards
</h3>
diff --git a/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs b/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs
index f7d9794..c3a143f 100644
--- a/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs
+++ b/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs
@@ -18,8 +18,21 @@ namespace WebFormsRelyingParty.Members {
protected void Page_Load(object sender, EventArgs e) {
Global.LoggedInUser.AuthenticationTokens.Load();
this.Repeater1.DataSource = Global.LoggedInUser.AuthenticationTokens;
+
+ if (!Global.LoggedInUser.IssuedToken.IsLoaded) {
+ Global.LoggedInUser.IssuedToken.Load();
+ }
+ this.tokenListRepeater.DataSource = Global.LoggedInUser.IssuedToken;
+ foreach (var token in Global.LoggedInUser.IssuedToken) {
+ if (!token.ConsumerReference.IsLoaded) {
+ token.ConsumerReference.Load();
+ }
+ }
+ this.authorizedClientsPanel.Visible = Global.LoggedInUser.IssuedToken.Count > 0;
+
if (!IsPostBack) {
this.Repeater1.DataBind();
+ this.tokenListRepeater.DataBind();
this.emailBox.Text = Global.LoggedInUser.EmailAddress;
this.emailVerifiedLabel.Visible = Global.LoggedInUser.EmailAddressVerified;
this.firstNameBox.Text = Global.LoggedInUser.FirstName;
@@ -56,6 +69,17 @@ namespace WebFormsRelyingParty.Members {
this.AddIdentifier(AuthenticationToken.SynthesizeClaimedIdentifierFromInfoCard(e.Token.UniqueId), e.Token.SiteSpecificId);
}
+ protected void revokeToken_Command(object sender, CommandEventArgs e) {
+ string token = (string)e.CommandArgument;
+ var tokenToRevoke = Global.DataContext.IssuedToken.FirstOrDefault(t => t.Token == token && t.User.Id == Global.LoggedInUser.Id);
+ if (tokenToRevoke != null) {
+ Global.DataContext.DeleteObject(tokenToRevoke);
+ }
+
+ this.tokenListRepeater.DataBind();
+ this.noAuthorizedClientsPanel.Visible = Global.LoggedInUser.IssuedToken.Count == 0;
+ }
+
private void AddIdentifier(string claimedId, string friendlyId) {
// Check that this identifier isn't already tied to a user account.
// We do this again here in case the LoggingIn event couldn't verify
diff --git a/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.designer.cs b/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.designer.cs
index bb08e65..359794b 100644
--- a/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.designer.cs
+++ b/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.designer.cs
@@ -95,6 +95,33 @@ namespace WebFormsRelyingParty.Members {
protected global::System.Web.UI.UpdateProgress UpdateProgress1;
/// <summary>
+ /// authorizedClientsPanel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.UpdatePanel authorizedClientsPanel;
+
+ /// <summary>
+ /// noAuthorizedClientsPanel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Panel noAuthorizedClientsPanel;
+
+ /// <summary>
+ /// tokenListRepeater control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Repeater tokenListRepeater;
+
+ /// <summary>
/// Repeater1 control.
/// </summary>
/// <remarks>
diff --git a/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx
index 896059d..7886157 100644
--- a/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx
+++ b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx
@@ -17,7 +17,8 @@
alright with you?
</p>
<p>
- If you grant access now, you can revoke it at any time by returning to this page.
+ If you grant access now, you can revoke it at any time by returning to <a href="AccountInfo.aspx"
+ target="_blank">your account page</a>.
</p>
<div style="display: none" id="responseButtonsDiv">
<asp:Button ID="yesButton" runat="server" Text="Yes" OnClick="yesButton_Click" />
@@ -28,8 +29,18 @@
<b>Javascript appears to be disabled in your browser. </b>This page requires Javascript
to be enabled to better protect your security.
</div>
- <asp:Panel runat="server" BackColor="Red" ForeColor="White" Font-Bold="true" Visible="false" ID="OAuth10ConsumerWarning">
- This website is registered with <asp:Label runat="server" ID="serviceProviderDomainNameLabel" /> to make authorization requests, but has not been configured to send requests securely. If you grant access but you did not initiate this request at <asp:Label runat="server" ID="consumerDomainNameLabel1" />, it may be possible for other users of <asp:Label runat="server" ID="consumerDomainNameLabel2" /> to access your data. We recommend you deny access unless you are certain that you initiated this request directly with <asp:Label runat="server" ID="consumerDomainNameLabel3" />.
+ <asp:Panel runat="server" BackColor="Red" ForeColor="White" Font-Bold="true" Visible="false"
+ ID="OAuth10ConsumerWarning">
+ This website is registered with
+ <asp:Label runat="server" ID="serviceProviderDomainNameLabel" />
+ to make authorization requests, but has not been configured to send requests securely.
+ If you grant access but you did not initiate this request at
+ <asp:Label runat="server" ID="consumerDomainNameLabel1" />, it may be possible for
+ other users of
+ <asp:Label runat="server" ID="consumerDomainNameLabel2" />
+ to access your data. We recommend you deny access unless you are certain that you
+ initiated this request directly with
+ <asp:Label runat="server" ID="consumerDomainNameLabel3" />.
</asp:Panel>
<script language="javascript" type="text/javascript">
@@ -49,19 +60,26 @@
</asp:View>
<asp:View ID="authorizationGrantedView" runat="server">
- <p>Authorization has been granted.</p>
+ <p>
+ Authorization has been granted.</p>
<asp:MultiView runat="server" ID="verifierMultiView" ActiveViewIndex="0">
<asp:View ID="verificationCodeView" runat="server">
- <p>You must enter this verification code at the Consumer: <asp:Label runat="server"
- ID="verificationCodeLabel" /> </p>
+ <p>
+ You must enter this verification code at the Consumer:
+ <asp:Label runat="server" ID="verificationCodeLabel" />
+ </p>
</asp:View>
<asp:View ID="noCallbackView" runat="server">
- <p>You may now close this window and return to the Consumer. </p>
+ <p>
+ You may now close this window and return to the Consumer.
+ </p>
</asp:View>
</asp:MultiView>
</asp:View>
<asp:View ID="authorizationDeniedView" runat="server">
- <p>Authorization has been denied. You're free to do whatever now. </p>
+ <p>
+ Authorization has been denied. You're free to do whatever now.
+ </p>
</asp:View>
</asp:MultiView>
</asp:Content>
diff --git a/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs
index 9773a67..d5ee5a5 100644
--- a/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs
+++ b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs
@@ -28,7 +28,7 @@ namespace WebFormsRelyingParty.Members {
OAuth10ConsumerWarning.Visible = pendingRequest.IsUnsafeRequest;
serviceProviderDomainNameLabel.Text = this.Request.Url.Host;
- consumerDomainNameLabel3.Text = consumerDomainNameLabel2.Text = consumerDomainNameLabel1.Text = OAuthServiceProvider.PendingAuthorizationConsumer.Name;
+ this.consumerDomainNameLabel3.Text = this.consumerDomainNameLabel2.Text = this.consumerDomainNameLabel1.Text = OAuthServiceProvider.PendingAuthorizationConsumer.Name;
} else {
Utilities.VerifyCsrfCookie(this.csrfCheck.Value);
}
@@ -48,9 +48,9 @@ namespace WebFormsRelyingParty.Members {
// The rest of this method only executes if we couldn't automatically
// redirect to the consumer.
if (pendingRequest.IsUnsafeRequest) {
- this.verifierMultiView.SetActiveView(noCallbackView);
+ this.verifierMultiView.SetActiveView(this.noCallbackView);
} else {
- this.verifierMultiView.SetActiveView(verificationCodeView);
+ this.verifierMultiView.SetActiveView(this.verificationCodeView);
string verifier = ServiceProvider.CreateVerificationCode(consumer.VerificationCodeFormat, consumer.VerificationCodeLength);
this.verificationCodeLabel.Text = verifier;
requestToken.VerificationCode = verifier;
@@ -59,7 +59,7 @@ namespace WebFormsRelyingParty.Members {
}
protected void noButton_Click(object sender, EventArgs e) {
- outerMultiView.SetActiveView(authorizationDeniedView);
+ this.outerMultiView.SetActiveView(this.authorizationDeniedView);
OAuthServiceProvider.PendingAuthorizationRequest = null;
}
}