diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-10 21:00:37 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-10 21:00:37 -0800 |
commit | 6df46c9875f82f5a5f94a082a0b699fde2978d6f (patch) | |
tree | 56df88c1a4fe02a363e5a0d7d087c1947322ab09 /projecttemplates/WebFormsRelyingParty/Members | |
parent | 5d4d80b4a83bb9d6af62cc5f6d78f6f7e541e67d (diff) | |
download | DotNetOpenAuth-6df46c9875f82f5a5f94a082a0b699fde2978d6f.zip DotNetOpenAuth-6df46c9875f82f5a5f94a082a0b699fde2978d6f.tar.gz DotNetOpenAuth-6df46c9875f82f5a5f94a082a0b699fde2978d6f.tar.bz2 |
Added a bunch more OAuth SP supporting code, but it's not done yet.
Diffstat (limited to 'projecttemplates/WebFormsRelyingParty/Members')
3 files changed, 113 insertions, 0 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx new file mode 100644 index 0000000..720c4b2 --- /dev/null +++ b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx @@ -0,0 +1,20 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" + CodeBehind="OAuthAuthorize.aspx.cs" Inherits="WebFormsRelyingParty.Members.OAuthAuthorize" %> + +<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> +</asp:Content> +<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="server"> + <h2> + Client authorization</h2> + <p> + The + <asp:Label ID="consumerNameLabel" runat="server" Text="(app name)" /> + application is requesting to access the private data in your account here. Is that + alright with you? + </p> + <asp:Button ID="yesButton" runat="server" Text="Yes" + onclick="yesButton_Click" /> + <asp:Button ID="noButton" runat="server" Text="No" + onclick="noButton_Click" /> + <asp:HiddenField runat="server" ID="csrfCheck" EnableViewState="false" /> +</asp:Content> diff --git a/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs new file mode 100644 index 0000000..4ffb9b8 --- /dev/null +++ b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs @@ -0,0 +1,41 @@ +//----------------------------------------------------------------------- +// <copyright file="OAuthAuthorize.aspx.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace WebFormsRelyingParty.Members { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web; + using System.Web.UI; + using System.Web.UI.WebControls; + using DotNetOpenAuth.OAuth; + using DotNetOpenAuth.OAuth.Messages; + using WebFormsRelyingParty.Code; + + public partial class OAuthAuthorize : System.Web.UI.Page { + protected void Page_Load(object sender, EventArgs e) { + if (!IsPostBack) { + if (OAuthServiceProvider.PendingAuthorizationRequest == null) { + Response.Redirect("~/"); + } + + this.csrfCheck.Value = Utilities.SetCsrfCookie(); + this.consumerNameLabel.Text = HttpUtility.HtmlEncode(OAuthServiceProvider.PendingAuthorizationConsumer.Name); + } else { + Utilities.VerifyCsrfCookie(this.csrfCheck.Value); + } + } + + protected void yesButton_Click(object sender, EventArgs e) { + OAuthServiceProvider.AuthorizePendingRequestToken(); + } + + protected void noButton_Click(object sender, EventArgs e) { + OAuthServiceProvider.PendingAuthorizationRequest = null; + Response.Redirect("~/"); + } + } +} diff --git a/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.designer.cs b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.designer.cs new file mode 100644 index 0000000..719a853 --- /dev/null +++ b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.designer.cs @@ -0,0 +1,52 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:2.0.50727.4927 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace WebFormsRelyingParty.Members { + + + public partial class OAuthAuthorize { + + /// <summary> + /// consumerNameLabel 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.Label consumerNameLabel; + + /// <summary> + /// yesButton 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.Button yesButton; + + /// <summary> + /// noButton 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.Button noButton; + + /// <summary> + /// csrfCheck 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.HiddenField csrfCheck; + } +} |