diff options
Diffstat (limited to 'src/OAuth/OAuthAuthorizationServer/Views')
9 files changed, 245 insertions, 0 deletions
diff --git a/src/OAuth/OAuthAuthorizationServer/Views/Account/LogOn.aspx b/src/OAuth/OAuthAuthorizationServer/Views/Account/LogOn.aspx new file mode 100644 index 0000000..e83a162 --- /dev/null +++ b/src/OAuth/OAuthAuthorizationServer/Views/Account/LogOn.aspx @@ -0,0 +1,31 @@ +<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<OAuthAuthorizationServer.Models.LogOnModel>" %> + +<asp:Content ID="loginTitle" ContentPlaceHolderID="TitleContent" runat="server"> + Log On +</asp:Content> +<asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server"> + <h2> + Log On</h2> + <% using (Html.BeginForm()) { %> + <%: Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.") %> + <div> + <fieldset> + <legend>Account Information</legend> + <div class="editor-label"> + <%: Html.LabelFor(m => m.UserSuppliedIdentifier) %> + </div> + <div class="editor-field"> + <%: Html.TextBoxFor(m => m.UserSuppliedIdentifier) %> + <%: Html.ValidationMessageFor(m => m.UserSuppliedIdentifier) %> + </div> + <div class="editor-label"> + <%: Html.CheckBoxFor(m => m.RememberMe) %> + <%: Html.LabelFor(m => m.RememberMe) %> + </div> + <p> + <input type="submit" value="Log On" /> + </p> + </fieldset> + </div> + <% } %> +</asp:Content> diff --git a/src/OAuth/OAuthAuthorizationServer/Views/Home/About.aspx b/src/OAuth/OAuthAuthorizationServer/Views/Home/About.aspx new file mode 100644 index 0000000..335c141 --- /dev/null +++ b/src/OAuth/OAuthAuthorizationServer/Views/Home/About.aspx @@ -0,0 +1,12 @@ +<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> + +<asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat="server"> + About Us +</asp:Content> + +<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server"> + <h2>About</h2> + <p> + Put content here. + </p> +</asp:Content> diff --git a/src/OAuth/OAuthAuthorizationServer/Views/Home/CreateDatabase.aspx b/src/OAuth/OAuthAuthorizationServer/Views/Home/CreateDatabase.aspx new file mode 100644 index 0000000..e7d57cc --- /dev/null +++ b/src/OAuth/OAuthAuthorizationServer/Views/Home/CreateDatabase.aspx @@ -0,0 +1,19 @@ +<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Views/Shared/Site.Master" %> + +<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="MainContent"> + <% if (ViewData["Success"] != null) { + %> + <p> + Database (re)created!</p> + <p> + Note that to be useful, you really need to either modify the database to add an + account with data that will be accessed by this sample, or modify this very page + to inject that data into the database. + </p> + <% + } + %> + <p style="color: Red; font-weight: bold"> + <%= ViewData["Error"] %> + </p> +</asp:Content> diff --git a/src/OAuth/OAuthAuthorizationServer/Views/Home/Index.aspx b/src/OAuth/OAuthAuthorizationServer/Views/Home/Index.aspx new file mode 100644 index 0000000..b4b1235 --- /dev/null +++ b/src/OAuth/OAuthAuthorizationServer/Views/Home/Index.aspx @@ -0,0 +1,18 @@ +<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> + +<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> + Home Page +</asp:Content> +<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> + <h2> + DotNetOpenAuth presents the OAuth 2.0 Authorization Server! + </h2> + <p> + To learn more about DotNetOpenAuth visit <a href="http://www.DotNetOpenAuth.net/" + title="DotNetOpenAuth web site">http://www.DotNetOpenAuth.net/</a>. + </p> + <% using (Html.BeginForm("CreateDatabase", "Home")) {%> + <input type="submit" value="(Re)Create Database" /> + <% + }%> +</asp:Content> diff --git a/src/OAuth/OAuthAuthorizationServer/Views/OAuth/Authorize.aspx b/src/OAuth/OAuthAuthorizationServer/Views/OAuth/Authorize.aspx new file mode 100644 index 0000000..94480f1 --- /dev/null +++ b/src/OAuth/OAuthAuthorizationServer/Views/OAuth/Authorize.aspx @@ -0,0 +1,65 @@ +<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<OAuthAuthorizationServer.Models.AccountAuthorizeModel>" %> +<%@ Import Namespace="DotNetOpenAuth.OAuth2" %> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> +<head runat="server"> + <title></title> +</head> +<body> + <h2> + Authorize + </h2> + <div style="background-color: Yellow"> + <b>Warning</b>: Never give your login credentials to another web site or application. + </div> + <p> + The + <%= Html.Encode(Model.ClientApp) %> + application is requesting to access the private data in your account here. Is that + alright with you? + </p> + <p> + <b>Requested access: </b> + <%= Html.Encode(String.Join(" ", Model.Scope.ToArray())) %> + </p> + <p> + If you grant access now, you can revoke it at any time by returning to + <%= Html.ActionLink("your account page", "Edit") %>. + </p> + <% using (Html.BeginForm("AuthorizeResponse", "OAuth")) { %> + <%= Html.AntiForgeryToken() %> + <%= Html.Hidden("IsApproved") %> + <%= Html.Hidden("client_id", Model.AuthorizationRequest.ClientIdentifier) %> + <%= Html.Hidden("redirect_uri", Model.AuthorizationRequest.Callback) %> + <%= Html.Hidden("state", Model.AuthorizationRequest.ClientState) %> + <%= Html.Hidden("scope", OAuthUtilities.JoinScopes(Model.AuthorizationRequest.Scope)) %> + <%= Html.Hidden("response_type", Model.AuthorizationRequest.ResponseType == DotNetOpenAuth.OAuth2.Messages.EndUserAuthorizationResponseType.AccessToken ? "token" : "code") %> + <div style="display: none" id="responseButtonsDiv"> + <input type="submit" value="Yes" onclick="document.getElementsByName('IsApproved')[0].value = true; return true;" /> + <input type="submit" value="No" onclick="document.getElementsByName('IsApproved')[0].value = false; return true;" /> + </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> + + <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> + + <% } %> +</body> +</html> diff --git a/src/OAuth/OAuthAuthorizationServer/Views/Shared/Error.aspx b/src/OAuth/OAuthAuthorizationServer/Views/Shared/Error.aspx new file mode 100644 index 0000000..144df3f --- /dev/null +++ b/src/OAuth/OAuthAuthorizationServer/Views/Shared/Error.aspx @@ -0,0 +1,11 @@ +<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<System.Web.Mvc.HandleErrorInfo>" %> + +<asp:Content ID="errorTitle" ContentPlaceHolderID="TitleContent" runat="server"> + Error +</asp:Content> + +<asp:Content ID="errorContent" ContentPlaceHolderID="MainContent" runat="server"> + <h2> + Sorry, an error occurred while processing your request. + </h2> +</asp:Content> diff --git a/src/OAuth/OAuthAuthorizationServer/Views/Shared/LogOnUserControl.ascx b/src/OAuth/OAuthAuthorizationServer/Views/Shared/LogOnUserControl.ascx new file mode 100644 index 0000000..9afaab3 --- /dev/null +++ b/src/OAuth/OAuthAuthorizationServer/Views/Shared/LogOnUserControl.ascx @@ -0,0 +1,14 @@ +<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> +<% + if (Request.IsAuthenticated) { +%> + Welcome <b><%: Page.User.Identity.Name %></b>! + [ <%: Html.ActionLink("Log Off", "LogOff", "Account") %> ] +<% + } + else { +%> + [ <%: Html.ActionLink("Log On", "LogOn", "Account") %> ] +<% + } +%> diff --git a/src/OAuth/OAuthAuthorizationServer/Views/Shared/Site.Master b/src/OAuth/OAuthAuthorizationServer/Views/Shared/Site.Master new file mode 100644 index 0000000..43f68e1 --- /dev/null +++ b/src/OAuth/OAuthAuthorizationServer/Views/Shared/Site.Master @@ -0,0 +1,40 @@ +<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head runat="server"> + <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> + <link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> +</head> + +<body> + <div class="page"> + + <div id="header"> + <div id="title"> + <h1>DotNetOpenAuth OAuth 2.0 Authorization Server</h1> + </div> + + <div id="logindisplay"> + <% Html.RenderPartial("LogOnUserControl"); %> + </div> + + <div id="menucontainer"> + + <ul id="menu"> + <li><%: Html.ActionLink("Home", "Index", "Home")%></li> + <li><%: Html.ActionLink("About", "About", "Home")%></li> + </ul> + + </div> + </div> + + <div id="main"> + <asp:ContentPlaceHolder ID="MainContent" runat="server" /> + + <div id="footer"> + </div> + </div> + </div> +</body> +</html> diff --git a/src/OAuth/OAuthAuthorizationServer/Views/Web.config b/src/OAuth/OAuthAuthorizationServer/Views/Web.config new file mode 100644 index 0000000..aa7a38d --- /dev/null +++ b/src/OAuth/OAuthAuthorizationServer/Views/Web.config @@ -0,0 +1,35 @@ +<?xml version="1.0"?> + +<configuration> + <system.web> + <httpHandlers> + <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/> + </httpHandlers> + + <!-- + Enabling request validation in view pages would cause validation to occur + after the input has already been processed by the controller. By default + MVC performs request validation before a controller processes the input. + To change this behavior apply the ValidateInputAttribute to a + controller or action. + --> + <pages + validateRequest="false" + pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" + pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" + userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> + <controls> + <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /> + </controls> + </pages> + </system.web> + + <system.webServer> + <validation validateIntegratedModeConfiguration="false" /> + + <handlers> + <remove name="BlockViewHandler"/> + <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /> + </handlers> + </system.webServer> +</configuration> |