diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-07-22 10:15:49 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-07-22 10:15:49 -0700 |
commit | 4d2ec520fe9b42d0d0f1b764029a33dab906e68a (patch) | |
tree | 17918d5b1c4580017d0cb2c6e6ddd8153cdadcfa /samples/OAuthServiceProvider/Members | |
parent | 431bf8c104dd498d1894083fc2ed4fa795bba7df (diff) | |
download | DotNetOpenAuth-4d2ec520fe9b42d0d0f1b764029a33dab906e68a.zip DotNetOpenAuth-4d2ec520fe9b42d0d0f1b764029a33dab906e68a.tar.gz DotNetOpenAuth-4d2ec520fe9b42d0d0f1b764029a33dab906e68a.tar.bz2 |
Stripping OAuth 1.0 support from the OAuthServiceProvider sample.
Diffstat (limited to 'samples/OAuthServiceProvider/Members')
3 files changed, 0 insertions, 243 deletions
diff --git a/samples/OAuthServiceProvider/Members/Authorize.aspx b/samples/OAuthServiceProvider/Members/Authorize.aspx deleted file mode 100644 index 251189a..0000000 --- a/samples/OAuthServiceProvider/Members/Authorize.aspx +++ /dev/null @@ -1,58 +0,0 @@ -<%@ Page Title="Authorize Access" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="OAuthServiceProvider.Authorize" Codebehind="Authorize.aspx.cs" %> - -<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server"> - <asp:MultiView runat="server" ActiveViewIndex="0" ID="multiView"> - <asp:View runat="server"> - <div style="background-color: Yellow"> - <b>Warning</b>: Never give your login credentials to another web site or application. - </div> - <asp:HiddenField runat="server" ID="OAuthAuthorizationSecToken" EnableViewState="false" /> - <p>The client web site or application <asp:Label ID="consumerLabel" Font-Bold="true" - runat="server" Text="[consumer]" /> wants access to your <asp:Label ID="desiredAccessLabel" - Font-Bold="true" runat="server" Text="[protected resource]" />. </p> - <p>Do you want to allow this? </p> - <div style="display: none" id="responseButtonsDiv"> - <asp:Button ID="allowAccessButton" runat="server" Text="Yes" OnClick="allowAccessButton_Click" /> - <asp:Button ID="denyAccessButton" runat="server" Text="No" OnClick="denyAccessButton_Click" /> - </div> - <div id="javascriptDisabled"> - <b>Javascript appears to be disabled in your browser. </b>This page requires Javascript - to be enabled to better protect your security. - </div> - <p>If you grant access now, you can revoke it at any time by returning to this page. - </p> - <asp:Panel runat="server" BackColor="Red" ForeColor="White" Font-Bold="true" Visible="false" ID="OAuth10ConsumerWarning"> - This website is registered with service_PROVIDER_DOMAIN_NAME 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 consumer_DOMAIN_NAME, it may be possible for other users of consumer_DOMAIN_NAME to access your data. We recommend you deny access unless you are certain that you initiated this request directly with consumer_DOMAIN_NAME. - </asp:Panel> - <script language="javascript" type="text/javascript"> - //<![CDATA[ - // we use HTML to hide the action buttons and Javascript to show them - // to protect against click-jacking in an iframe whose javascript is disabled. - document.getElementById('responseButtonsDiv').style.display = 'block'; - document.getElementById('javascriptDisabled').style.display = 'none'; - - // Frame busting code (to protect us from being hosted in an iframe). - // This protects us from click-jacking. - if (document.location !== window.top.location) { - window.top.location = document.location; - } - //]]> - </script> - </asp:View> - <asp:View runat="server"> - <p>Authorization has been granted.</p> - <asp:MultiView runat="server" ID="verifierMultiView" ActiveViewIndex="0"> - <asp:View runat="server"> - <p>You must enter this verification code at the Consumer: <asp:Label runat="server" - ID="verificationCodeLabel" /> </p> - </asp:View> - <asp:View ID="View1" runat="server"> - <p>You may now close this window and return to the Consumer. </p> - </asp:View> - </asp:MultiView> - </asp:View> - <asp:View runat="server"> - <p>Authorization has been denied. You're free to do whatever now. </p> - </asp:View> - </asp:MultiView> -</asp:Content> diff --git a/samples/OAuthServiceProvider/Members/Authorize.aspx.cs b/samples/OAuthServiceProvider/Members/Authorize.aspx.cs deleted file mode 100644 index faa2147..0000000 --- a/samples/OAuthServiceProvider/Members/Authorize.aspx.cs +++ /dev/null @@ -1,80 +0,0 @@ -namespace OAuthServiceProvider { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Security.Cryptography; - using System.Web; - using System.Web.UI; - using System.Web.UI.WebControls; - using DotNetOpenAuth; - using DotNetOpenAuth.OAuth; - using DotNetOpenAuth.OAuth.Messages; - using OAuthServiceProvider.Code; - - /// <summary> - /// Conducts the user through a Consumer authorization process. - /// </summary> - public partial class Authorize : System.Web.UI.Page { - private static readonly RandomNumberGenerator CryptoRandomDataGenerator = new RNGCryptoServiceProvider(); - - private string AuthorizationSecret { - get { return Session["OAuthAuthorizationSecret"] as string; } - set { Session["OAuthAuthorizationSecret"] = value; } - } - - protected void Page_Load(object sender, EventArgs e) { - if (!IsPostBack) { - if (Global.PendingOAuthAuthorization == null) { - Response.Redirect("~/Members/AuthorizedConsumers.aspx"); - } else { - ITokenContainingMessage pendingToken = Global.PendingOAuthAuthorization; - var token = Global.DataContext.OAuthTokens.Single(t => t.Token == pendingToken.Token); - this.desiredAccessLabel.Text = token.Scope; - this.consumerLabel.Text = Global.TokenManager.GetConsumerForToken(token.Token).ConsumerKey; - - // Generate an unpredictable secret that goes to the user agent and must come back - // with authorization to guarantee the user interacted with this page rather than - // being scripted by an evil Consumer. - byte[] randomData = new byte[8]; - CryptoRandomDataGenerator.GetBytes(randomData); - this.AuthorizationSecret = Convert.ToBase64String(randomData); - this.OAuthAuthorizationSecToken.Value = this.AuthorizationSecret; - - this.OAuth10ConsumerWarning.Visible = Global.PendingOAuthAuthorization.IsUnsafeRequest; - } - } - } - - protected void allowAccessButton_Click(object sender, EventArgs e) { - if (this.AuthorizationSecret != this.OAuthAuthorizationSecToken.Value) { - throw new ArgumentException(); // probably someone trying to hack in. - } - this.AuthorizationSecret = null; // clear one time use secret - var pending = Global.PendingOAuthAuthorization; - Global.AuthorizePendingRequestToken(); - this.multiView.ActiveViewIndex = 1; - - ServiceProvider sp = new ServiceProvider(Constants.SelfDescription, Global.TokenManager); - var response = sp.PrepareAuthorizationResponse(pending); - if (response != null) { - sp.Channel.Send(response); - } else { - if (pending.IsUnsafeRequest) { - this.verifierMultiView.ActiveViewIndex = 1; - } else { - string verifier = ServiceProvider.CreateVerificationCode(VerificationCodeFormat.AlphaNumericNoLookAlikes, 10); - this.verificationCodeLabel.Text = verifier; - ITokenContainingMessage requestTokenMessage = pending; - var requestToken = Global.TokenManager.GetRequestToken(requestTokenMessage.Token); - requestToken.VerificationCode = verifier; - Global.TokenManager.UpdateToken(requestToken); - } - } - } - - protected void denyAccessButton_Click(object sender, EventArgs e) { - // erase the request token. - this.multiView.ActiveViewIndex = 2; - } - } -}
\ No newline at end of file diff --git a/samples/OAuthServiceProvider/Members/Authorize.aspx.designer.cs b/samples/OAuthServiceProvider/Members/Authorize.aspx.designer.cs deleted file mode 100644 index 8aaf94d..0000000 --- a/samples/OAuthServiceProvider/Members/Authorize.aspx.designer.cs +++ /dev/null @@ -1,105 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace OAuthServiceProvider { - - - public partial class Authorize { - - /// <summary> - /// multiView 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.MultiView multiView; - - /// <summary> - /// OAuthAuthorizationSecToken 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 OAuthAuthorizationSecToken; - - /// <summary> - /// consumerLabel 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 consumerLabel; - - /// <summary> - /// desiredAccessLabel 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 desiredAccessLabel; - - /// <summary> - /// allowAccessButton 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 allowAccessButton; - - /// <summary> - /// denyAccessButton 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 denyAccessButton; - - /// <summary> - /// OAuth10ConsumerWarning 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 OAuth10ConsumerWarning; - - /// <summary> - /// verifierMultiView 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.MultiView verifierMultiView; - - /// <summary> - /// verificationCodeLabel 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 verificationCodeLabel; - - /// <summary> - /// View1 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.View View1; - } -} |