diff options
Diffstat (limited to 'projecttemplates/WebFormsRelyingParty')
7 files changed, 104 insertions, 27 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/Default.aspx b/projecttemplates/WebFormsRelyingParty/Default.aspx index e470320..c58805c 100644 --- a/projecttemplates/WebFormsRelyingParty/Default.aspx +++ b/projecttemplates/WebFormsRelyingParty/Default.aspx @@ -1,5 +1,5 @@ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebFormsRelyingParty._Default" - MasterPageFile="~/Site.Master" %> + MasterPageFile="~/Site.Master" Title="OpenID + InfoCard Relying Party template" %> <%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth" TagPrefix="dnoa" %> <asp:Content runat="server" ContentPlaceHolderID="head"> diff --git a/projecttemplates/WebFormsRelyingParty/Global.asax.cs b/projecttemplates/WebFormsRelyingParty/Global.asax.cs index cc69f0c..0d99ac9 100644 --- a/projecttemplates/WebFormsRelyingParty/Global.asax.cs +++ b/projecttemplates/WebFormsRelyingParty/Global.asax.cs @@ -14,7 +14,7 @@ namespace WebFormsRelyingParty { public class Global : System.Web.HttpApplication { /// <summary> - /// The logger for this sample to use. + /// The logger for this web site to use. /// </summary> private static log4net.ILog logger = log4net.LogManager.GetLogger("WebFormsRelyingParty"); @@ -40,7 +40,7 @@ namespace WebFormsRelyingParty { } protected void Application_Error(object sender, EventArgs e) { - Logger.Error("An unhandled exception occurred in ASP.NET processing: " + Server.GetLastError(), Server.GetLastError()); + Logger.Error("An unhandled exception occurred in ASP.NET processing for page " + HttpContext.Current.Request.Path, Server.GetLastError()); } protected void Session_End(object sender, EventArgs e) { diff --git a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs index 2e0b4c0..152884e 100644 --- a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs +++ b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs @@ -25,6 +25,11 @@ "getTopWindowUrl", "document.getElementById('topWindowUrl').value = window.parent.location.href;"); } + + // We set the privacy policy URL here instead of in the ASPX page with the rest of the + // Simple Registration extension so that we can construct the absolute URL rather than + // hard-coding it. + this.openIdSelector.Extensions.OfType<ClaimsRequest>().Single().PolicyUrl = new Uri(Request.Url, Page.ResolveUrl("~/PrivacyPolicy.aspx")); } protected void openIdSelector_LoggedIn(object sender, OpenIdEventArgs e) { diff --git a/projecttemplates/WebFormsRelyingParty/PrivacyPolicy.aspx b/projecttemplates/WebFormsRelyingParty/PrivacyPolicy.aspx new file mode 100644 index 0000000..82be533 --- /dev/null +++ b/projecttemplates/WebFormsRelyingParty/PrivacyPolicy.aspx @@ -0,0 +1,10 @@ +<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" %> + +<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Body"> + <h2> + Privacy Policy + </h2> + <p> + Some privacy policy would go here. + </p> +</asp:Content> diff --git a/projecttemplates/WebFormsRelyingParty/Site.Master b/projecttemplates/WebFormsRelyingParty/Site.Master index 8a4cfd2..6d74076 100644 --- a/projecttemplates/WebFormsRelyingParty/Site.Master +++ b/projecttemplates/WebFormsRelyingParty/Site.Master @@ -42,17 +42,19 @@ </div> </form> -<% if (Request.Url.IsLoopback) { %> - <script type="text/javascript" src="scripts/jquery-1.3.1.js"></script> - <script type="text/javascript" src="scripts/jquery-ui-personalized-1.6rc6.js"></script> -<% } else { %> - <script type="text/javascript" language="javascript" src="http://www.google.com/jsapi"></script> - <script type="text/javascript" language="javascript"> - google.load("jquery", "1.3.2"); - google.load("jqueryui", "1.7.2"); - </script> -<% } %> +<% if (!this.Page.User.Identity.IsAuthenticated) { %> + <% if (Request.Url.IsLoopback) { %> + <script type="text/javascript" src="scripts/jquery-1.3.1.js"></script> + <script type="text/javascript" src="scripts/jquery-ui-personalized-1.6rc6.js"></script> + <% } else { %> + <script type="text/javascript" language="javascript" src="http://www.google.com/jsapi"></script> + <script type="text/javascript" language="javascript"> + google.load("jquery", "1.3.2"); + google.load("jqueryui", "1.7.2"); + </script> + <% } %> <script type="text/javascript" language="javascript" src="scripts/LoginLink.js"></script> +<% } %> </body> </html> diff --git a/projecttemplates/WebFormsRelyingParty/Web.config b/projecttemplates/WebFormsRelyingParty/Web.config index adac052..1d7c29f 100644 --- a/projecttemplates/WebFormsRelyingParty/Web.config +++ b/projecttemplates/WebFormsRelyingParty/Web.config @@ -1,4 +1,12 @@ <?xml version="1.0"?> +<!-- + Note: As an alternative to hand editing this file you can use the + web admin tool to configure settings for your application. Use + the Website->Asp.Net Configuration option in Visual Studio. + A full list of settings and comments can be found in + machine.config.comments usually located in + \Windows\Microsoft.Net\Framework\v2.x\Config +--> <configuration> <configSections> <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> @@ -16,6 +24,7 @@ </sectionGroup> </sectionGroup> </configSections> + <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names), which is necessary for OpenID urls with unicode characters in the domain/host name. It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. --> @@ -23,6 +32,7 @@ <idn enabled="All" /> <iriParsing enabled="true" /> </uri> + <system.net> <defaultProxy enabled="true" /> <settings> @@ -32,6 +42,7 @@ <servicePointManager checkCertificateRevocationList="true" /> </settings> </system.net> + <!-- this is an optional configuration section where aspects of dotnetopenauth can be customized --> <dotNetOpenAuth> <messaging> @@ -56,32 +67,80 @@ <store type="RelyingPartyLogic.NonceDbStore, RelyingPartyLogic"/> </serviceProvider> </oauth> + <!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. --> + <reporting enabled="true" /> </dotNetOpenAuth> - <!-- log4net is a 3rd party (free) logger library that dotnetopenid will use if present but does not require. --> + + <!-- log4net is a 3rd party (free) logger library that DotNetOpenAuth will use if present but does not require. --> <log4net> - <!--<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> - <file value="RelyingParty.log" /> - <appendToFile value="true" /> - <rollingStyle value="Size" /> - <maxSizeRollBackups value="10" /> - <maximumFileSize value="100KB" /> - <staticLogFileName value="true" /> - <layout type="log4net.Layout.PatternLayout"> - <conversionPattern value="%date (GMT%date{%z}) [%thread] %-5level %logger - %message%newline" /> - </layout> - </appender>--> + <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender"> + <bufferSize value="100" /> + <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <connectionString value="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\WebFormsRelyingParty.mdf;Integrated Security=True;User Instance=True" /> + <commandText value="INSERT INTO [Log] ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)" /> + <parameter> + <parameterName value="@log_date" /> + <dbType value="DateTime" /> + <layout type="log4net.Layout.RawTimeStampLayout" /> + </parameter> + <parameter> + <parameterName value="@thread" /> + <dbType value="String" /> + <size value="255" /> + <layout type="log4net.Layout.PatternLayout"> + <conversionPattern value="%thread" /> + </layout> + </parameter> + <parameter> + <parameterName value="@log_level" /> + <dbType value="String" /> + <size value="50" /> + <layout type="log4net.Layout.PatternLayout"> + <conversionPattern value="%level" /> + </layout> + </parameter> + <parameter> + <parameterName value="@logger" /> + <dbType value="String" /> + <size value="255" /> + <layout type="log4net.Layout.PatternLayout"> + <conversionPattern value="%logger" /> + </layout> + </parameter> + <parameter> + <parameterName value="@message" /> + <dbType value="String" /> + <size value="4000" /> + <layout type="log4net.Layout.PatternLayout"> + <conversionPattern value="%message" /> + </layout> + </parameter> + <parameter> + <parameterName value="@exception" /> + <dbType value="String" /> + <size value="2000" /> + <layout type="log4net.Layout.ExceptionLayout" /> + </parameter> + </appender> <!-- Setup the root category, add the appenders and set the default level --> <root> <level value="WARN" /> - <appender-ref ref="RollingFileAppender" /> + <appender-ref ref="AdoNetAppender" /> </root> <!-- Specify the level for some specific categories --> <logger name="DotNetOpenAuth"> <level value="WARN" /> </logger> + <logger name="DotNetOpenAuth.OpenId"> + <level value="INFO" /> + </logger> + <logger name="DotNetOpenAuth.OAuth"> + <level value="INFO" /> + </logger> </log4net> <appSettings /> <connectionStrings> + <!-- Remember to keep this connection string in sync with the one (if any) that appears in the log4net section. --> <add name="DatabaseEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\WebFormsRelyingParty.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" /> </connectionStrings> <system.web> @@ -204,4 +263,4 @@ </authorization> </system.web> </location> -</configuration>
\ No newline at end of file +</configuration> diff --git a/projecttemplates/WebFormsRelyingParty/WebFormsRelyingParty.csproj b/projecttemplates/WebFormsRelyingParty/WebFormsRelyingParty.csproj index 4b30170..9db3c05 100644 --- a/projecttemplates/WebFormsRelyingParty/WebFormsRelyingParty.csproj +++ b/projecttemplates/WebFormsRelyingParty/WebFormsRelyingParty.csproj @@ -236,6 +236,7 @@ <Content Include="images\verisign.gif" /> <Content Include="Members\OAuthAuthorize.aspx" /> <Content Include="OAuth.ashx" /> + <Content Include="PrivacyPolicy.aspx" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\src\DotNetOpenAuth\DotNetOpenAuth.csproj"> |