summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
Diffstat (limited to 'samples')
-rw-r--r--samples/DotNetOpenId.Samples.sln12
-rw-r--r--samples/ProviderCustomStore/.gitignore4
-rw-r--r--samples/ProviderCustomStore/Default.aspx29
-rw-r--r--samples/ProviderCustomStore/Global.asax1
-rw-r--r--samples/ProviderCustomStore/Global.asax.cs15
-rw-r--r--samples/ProviderCustomStore/Properties/AssemblyInfo.cs35
-rw-r--r--samples/ProviderCustomStore/ProviderCustomStore.csproj122
-rw-r--r--samples/ProviderCustomStore/Server.aspx44
-rw-r--r--samples/ProviderCustomStore/Server.aspx.cs26
-rw-r--r--samples/ProviderCustomStore/Server.aspx.designer.cs23
-rw-r--r--samples/ProviderCustomStore/Web.config64
-rw-r--r--samples/ProviderCustomStore/op_xrds.aspx19
-rw-r--r--samples/ProviderCustomStore/user.aspx17
-rw-r--r--samples/ProviderCustomStore/user_xrds.aspx24
-rw-r--r--samples/ProviderPortal/Code/CustomStore.cs (renamed from samples/ProviderCustomStore/CustomStore.cs)5
-rw-r--r--samples/ProviderPortal/Code/CustomStoreDataSet.Designer.cs (renamed from samples/ProviderCustomStore/CustomStoreDataSet.Designer.cs)4
-rw-r--r--samples/ProviderPortal/Code/CustomStoreDataSet.xsc (renamed from samples/ProviderCustomStore/CustomStoreDataSet.xsc)0
-rw-r--r--samples/ProviderPortal/Code/CustomStoreDataSet.xsd (renamed from samples/ProviderCustomStore/CustomStoreDataSet.xsd)0
-rw-r--r--samples/ProviderPortal/Code/CustomStoreDataSet.xss (renamed from samples/ProviderCustomStore/CustomStoreDataSet.xss)0
-rw-r--r--samples/ProviderPortal/Code/Util.cs25
-rw-r--r--samples/ProviderPortal/Global.asax.cs5
-rw-r--r--samples/ProviderPortal/Provider.ashx1
-rw-r--r--samples/ProviderPortal/Provider.ashx.cs62
-rw-r--r--samples/ProviderPortal/ProviderPortal.csproj23
-rw-r--r--samples/ProviderPortal/Web.config17
-rw-r--r--samples/ProviderPortal/decide.aspx.cs11
-rw-r--r--samples/ProviderPortal/server.aspx7
-rw-r--r--samples/ProviderPortal/server.aspx.cs20
-rw-r--r--samples/ProviderPortal/server.aspx.designer.cs2
-rw-r--r--samples/ProviderPortal/user.aspx5
-rw-r--r--samples/ProviderPortal/user.aspx.cs13
-rw-r--r--samples/RelyingPartyCustomStore/.gitignore4
-rw-r--r--samples/RelyingPartyCustomStore/Default.aspx30
-rw-r--r--samples/RelyingPartyCustomStore/Global.asax1
-rw-r--r--samples/RelyingPartyCustomStore/Global.asax.cs16
-rw-r--r--samples/RelyingPartyCustomStore/MembersOnly/Default.aspx21
-rw-r--r--samples/RelyingPartyCustomStore/MembersOnly/Web.config18
-rw-r--r--samples/RelyingPartyCustomStore/Properties/AssemblyInfo.cs35
-rw-r--r--samples/RelyingPartyCustomStore/RelyingPartyCustomStore.csproj116
-rw-r--r--samples/RelyingPartyCustomStore/Web.config29
-rw-r--r--samples/RelyingPartyCustomStore/login.aspx24
-rw-r--r--samples/RelyingPartyCustomStore/login.aspx.cs33
-rw-r--r--samples/RelyingPartyCustomStore/login.aspx.designer.cs68
-rw-r--r--samples/RelyingPartyMvc/Global.asax.cs5
-rw-r--r--samples/RelyingPartyMvc/Web.config13
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStore.cs (renamed from samples/RelyingPartyCustomStore/CustomStore.cs)10
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStoreDataSet.Designer.cs (renamed from samples/RelyingPartyCustomStore/CustomStoreDataSet.Designer.cs)4
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStoreDataSet.cs6
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsc (renamed from samples/RelyingPartyCustomStore/CustomStoreDataSet.xsc)0
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsd (renamed from samples/RelyingPartyCustomStore/CustomStoreDataSet.xsd)0
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStoreDataSet.xss (renamed from samples/RelyingPartyCustomStore/CustomStoreDataSet.xss)0
-rw-r--r--samples/RelyingPartyPortal/Global.asax.cs5
-rw-r--r--samples/RelyingPartyPortal/RelyingPartyPortal.csproj28
-rw-r--r--samples/RelyingPartyPortal/Web.config19
-rw-r--r--samples/RelyingPartyPortal/loginProgrammatic.aspx.cs39
55 files changed, 271 insertions, 888 deletions
diff --git a/samples/DotNetOpenId.Samples.sln b/samples/DotNetOpenId.Samples.sln
index 5bc28b4..86e8db0 100644
--- a/samples/DotNetOpenId.Samples.sln
+++ b/samples/DotNetOpenId.Samples.sln
@@ -5,10 +5,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RelyingPartyPortal", "Relyi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProviderPortal", "ProviderPortal\ProviderPortal.csproj", "{2A59DE0A-B76A-4B42-9A33-04D34548353D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProviderCustomStore", "ProviderCustomStore\ProviderCustomStore.csproj", "{2D0B2C39-3F90-484E-848B-F3EF956835C3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RelyingPartyCustomStore", "RelyingPartyCustomStore\RelyingPartyCustomStore.csproj", "{DB54DC19-BA56-4C22-A8A0-C49289EA4F53}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RelyingPartyMvc", "RelyingPartyMvc\RelyingPartyMvc.csproj", "{07B193F1-68AD-4E9C-98AF-BEFB5E9403CB}"
EndProject
Global
@@ -25,14 +21,6 @@ Global
{2A59DE0A-B76A-4B42-9A33-04D34548353D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A59DE0A-B76A-4B42-9A33-04D34548353D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A59DE0A-B76A-4B42-9A33-04D34548353D}.Release|Any CPU.Build.0 = Release|Any CPU
- {2D0B2C39-3F90-484E-848B-F3EF956835C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2D0B2C39-3F90-484E-848B-F3EF956835C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2D0B2C39-3F90-484E-848B-F3EF956835C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2D0B2C39-3F90-484E-848B-F3EF956835C3}.Release|Any CPU.Build.0 = Release|Any CPU
- {DB54DC19-BA56-4C22-A8A0-C49289EA4F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DB54DC19-BA56-4C22-A8A0-C49289EA4F53}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DB54DC19-BA56-4C22-A8A0-C49289EA4F53}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DB54DC19-BA56-4C22-A8A0-C49289EA4F53}.Release|Any CPU.Build.0 = Release|Any CPU
{07B193F1-68AD-4E9C-98AF-BEFB5E9403CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07B193F1-68AD-4E9C-98AF-BEFB5E9403CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07B193F1-68AD-4E9C-98AF-BEFB5E9403CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/samples/ProviderCustomStore/.gitignore b/samples/ProviderCustomStore/.gitignore
deleted file mode 100644
index f4e2383..0000000
--- a/samples/ProviderCustomStore/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Bin
-obj
-*.user
-*Trace.txt
diff --git a/samples/ProviderCustomStore/Default.aspx b/samples/ProviderCustomStore/Default.aspx
deleted file mode 100644
index 375b3cb..0000000
--- a/samples/ProviderCustomStore/Default.aspx
+++ /dev/null
@@ -1,29 +0,0 @@
-<%@ Page Language="C#" AutoEventWireup="true" %>
-
-<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId" TagPrefix="openid" %>
-<!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">
- <openid:XrdsPublisher runat="server" XrdsUrl="~/op_xrds.aspx" />
- <title>OpenID Provider, by DotNetOpenId</title>
-</head>
-<body>
- <form id="form1" runat="server">
- <h1>
- OpenID Provider, with custom store
- </h1>
- <h2>
- Provided by <a href="http://dotnetopenid.googlecode.com">DotNetOpenId</a>
- </h2>
- <p>
- This sample implements a custom store for associations, which can be useful when
- deploying an OpenId provider site on a web farm.
- </p>
- <p>
- This is a very stripped-down sample. No login is required on this site as it automatically
- responds affirmatively to any OpenId request sent to it. Start the authentication
- process on the Relying Party sample site.
- </p>
- </form>
-</body>
-</html>
diff --git a/samples/ProviderCustomStore/Global.asax b/samples/ProviderCustomStore/Global.asax
deleted file mode 100644
index 3fe35c6..0000000
--- a/samples/ProviderCustomStore/Global.asax
+++ /dev/null
@@ -1 +0,0 @@
-<%@ Application Codebehind="Global.asax.cs" Inherits="ProviderCustomStore.Global" Language="C#" %>
diff --git a/samples/ProviderCustomStore/Global.asax.cs b/samples/ProviderCustomStore/Global.asax.cs
deleted file mode 100644
index ad31f4f..0000000
--- a/samples/ProviderCustomStore/Global.asax.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using ProviderPortal;
-
-namespace ProviderCustomStore {
- public class Global : System.Web.HttpApplication {
- public Global() {
- // since this is a sample, and will often be used with localhost
- DotNetOpenId.UntrustedWebRequest.WhitelistHosts.Add("localhost");
- }
-
- protected void Application_BeginRequest(object sender, EventArgs e) {
- URLRewriter.Process();
- }
- }
-} \ No newline at end of file
diff --git a/samples/ProviderCustomStore/Properties/AssemblyInfo.cs b/samples/ProviderCustomStore/Properties/AssemblyInfo.cs
deleted file mode 100644
index 166993e..0000000
--- a/samples/ProviderCustomStore/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("ProviderCustomStore")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ProviderCustomStore")]
-[assembly: AssemblyCopyright("Copyright © 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/samples/ProviderCustomStore/ProviderCustomStore.csproj b/samples/ProviderCustomStore/ProviderCustomStore.csproj
deleted file mode 100644
index 32ebced..0000000
--- a/samples/ProviderCustomStore/ProviderCustomStore.csproj
+++ /dev/null
@@ -1,122 +0,0 @@
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{2D0B2C39-3F90-484E-848B-F3EF956835C3}</ProjectGuid>
- <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>ProviderCustomStore</RootNamespace>
- <AssemblyName>ProviderCustomStore</AssemblyName>
- <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Drawing" />
- <Reference Include="System.Web" />
- <Reference Include="System.Xml" />
- <Reference Include="System.Configuration" />
- <Reference Include="System.Web.Services" />
- <Reference Include="System.EnterpriseServices" />
- <Reference Include="System.Web.Mobile" />
- </ItemGroup>
- <ItemGroup>
- <Content Include="Default.aspx" />
- <Content Include="Global.asax" />
- <Content Include="op_xrds.aspx" />
- <Content Include="Server.aspx" />
- <Content Include="user.aspx" />
- <Content Include="user_xrds.aspx" />
- <Content Include="Web.config" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\ProviderPortal\Code\URLRewriter.cs">
- <Link>URLRewriter.cs</Link>
- </Compile>
- <Compile Include="CustomStore.cs" />
- <Compile Include="CustomStoreDataSet.Designer.cs">
- <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- </Compile>
- <Compile Include="Global.asax.cs">
- <DependentUpon>Global.asax</DependentUpon>
- </Compile>
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Server.aspx.cs">
- <DependentUpon>Server.aspx</DependentUpon>
- <SubType>ASPXCodeBehind</SubType>
- </Compile>
- <Compile Include="Server.aspx.designer.cs">
- <DependentUpon>Server.aspx</DependentUpon>
- </Compile>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\src\DotNetOpenId\DotNetOpenId.csproj">
- <Project>{5D6EDC86-F5B2-4786-8376-4E7C24C63D39}</Project>
- <Name>DotNetOpenId</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="CustomStoreDataSet.xsc">
- <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
- </None>
- <None Include="CustomStoreDataSet.xsd">
- <Generator>MSDataSetGenerator</Generator>
- <LastGenOutput>CustomStoreDataSet.Designer.cs</LastGenOutput>
- <SubType>Designer</SubType>
- </None>
- <None Include="CustomStoreDataSet.xss">
- <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
- </None>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <ProjectExtensions>
- <VisualStudio>
- <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
- <WebProjectProperties>
- <UseIIS>False</UseIIS>
- <AutoAssignPort>True</AutoAssignPort>
- <DevelopmentServerPort>1230</DevelopmentServerPort>
- <DevelopmentServerVPath>/</DevelopmentServerVPath>
- <IISUrl>
- </IISUrl>
- <NTLMAuthentication>False</NTLMAuthentication>
- <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
- </WebProjectProperties>
- </FlavorProperties>
- </VisualStudio>
- </ProjectExtensions>
-</Project> \ No newline at end of file
diff --git a/samples/ProviderCustomStore/Server.aspx b/samples/ProviderCustomStore/Server.aspx
deleted file mode 100644
index 8b487a5..0000000
--- a/samples/ProviderCustomStore/Server.aspx
+++ /dev/null
@@ -1,44 +0,0 @@
-<%@ Page Language="C#" AutoEventWireup="true" Inherits="Server" CodeBehind="server.aspx.cs" ValidateRequest="false" %>
-
-<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId.Provider" TagPrefix="openid" %>
-<html>
-<head>
- <title>This is an OpenID server</title>
-</head>
-<body>
- <form id="Form1" runat='server'>
- <p>
- This is an OpenID server endpoint.
- </p>
- <p>
- For more information about OpenID, see:
- </p>
- <table>
- <tr>
- <td>
- <a href="http://dotnetopenid.googlecode.com/">http://dotnetopenid.googlecode.com/</a>
- </td>
- <td>
- Home of this library
- </td>
- </tr>
- <tr>
- <td>
- <a href="http://www.openid.net/">http://www.openid.net/</a>
- </td>
- <td>
- The official OpenID Web site
- </td>
- </tr>
- <tr>
- <td>
- <a href="http://www.openidenabled.com/">http://www.openidenabled.com/</a>
- </td>
- <td>
- An OpenID community Web site
- </td>
- </tr>
- </table>
- </form>
-</body>
-</html>
diff --git a/samples/ProviderCustomStore/Server.aspx.cs b/samples/ProviderCustomStore/Server.aspx.cs
deleted file mode 100644
index 9d4a9f6..0000000
--- a/samples/ProviderCustomStore/Server.aspx.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Specialized;
-using System.Diagnostics;
-using DotNetOpenId.Provider;
-using ProviderCustomStore;
-
-public partial class Server : System.Web.UI.Page {
- protected void Page_Load(object sender, EventArgs e) {
- var builder = new UriBuilder(Request.Url);
- builder.Query = null;
- builder.Fragment = null;
- Uri providerEndpoint = builder.Uri;
- NameValueCollection query = Request.RequestType == "GET" ? Request.QueryString : Request.Form;
- OpenIdProvider op = new OpenIdProvider(CustomStore.Instance, providerEndpoint, Request.Url, query);
- if (op.Request != null) {
- if (!op.Request.IsResponseReady) {
- var request = (IAuthenticationRequest)op.Request;
- if (request.IsDirectedIdentity) throw new NotSupportedException("This sample does not implement directed identity support.");
- request.IsAuthenticated = true;
- }
- Debug.Assert(op.Request.IsResponseReady);
- op.Request.Response.Send();
- Response.End();
- }
- }
-}
diff --git a/samples/ProviderCustomStore/Server.aspx.designer.cs b/samples/ProviderCustomStore/Server.aspx.designer.cs
deleted file mode 100644
index 6a53f1f..0000000
--- a/samples/ProviderCustomStore/Server.aspx.designer.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.1434
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-
-
-public partial class Server {
-
- /// <summary>
- /// Form1 control.
- /// </summary>
- /// <remarks>
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- /// </remarks>
- protected global::System.Web.UI.HtmlControls.HtmlForm Form1;
-}
diff --git a/samples/ProviderCustomStore/Web.config b/samples/ProviderCustomStore/Web.config
deleted file mode 100644
index 1d4b0d4..0000000
--- a/samples/ProviderCustomStore/Web.config
+++ /dev/null
@@ -1,64 +0,0 @@
-<?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="urlrewrites" type="ProviderPortal.URLRewriter"/>
- </configSections>
- <connectionStrings/>
- <!--
- Original version created by Richard Birkby (2002-02-22, http://www.codeproject.com/aspnet/URLRewriter.asp)
- Maps from old website to new website using Regular Expressions
- rule/url - old website url (Regular Expression)
- rule/rewrite - new website replacement expression
- Of two or more rules which match a given request, the first will always take precedance.
- -->
- <urlrewrites>
- <rule>
- <!-- This rewrites urls like: user/john ->user.aspx?username=john-->
- <url>/user/(.*)</url>
- <rewrite>/user.aspx?username=$1</rewrite>
- </rule>
- </urlrewrites>
- <system.web>
- <compilation debug="true" />
- <sessionState mode="InProc" cookieless="false"/>
- <membership>
- <providers>
- <clear/>
- <add
- name="AspNetSqlMembershipProvider"
- type="System.Web.Security.SqlMembershipProvider"
- connectionStringName="LocalSqlServer"
- enablePasswordRetrieval="false"
- enablePasswordReset="true"
- requiresQuestionAndAnswer="false"
- applicationName="/"
- requiresUniqueEmail="false"
- passwordFormat="Hashed"
- maxInvalidPasswordAttempts="5"
- minRequiredPasswordLength="1"
- minRequiredNonalphanumericCharacters="0"
- passwordAttemptWindow="10"
- passwordStrengthRegularExpression=""
- />
- </providers>
- </membership>
- <authentication mode="Forms">
- <forms name="ProviderCustomStoreSession"/> <!-- named cookie prevents conflicts with other samples -->
- </authentication>
- <customErrors mode="RemoteOnly"/>
- <!-- Trust level discussion:
- Full: everything works
- High: TRACE compilation symbol must NOT be defined
- Medium/Low: doesn't work on default machine.config. ConfigurationPermission is denied (why is it needed?)
- -->
- <trust level="Full" originUrl=""/>
- </system.web>
-</configuration>
diff --git a/samples/ProviderCustomStore/op_xrds.aspx b/samples/ProviderCustomStore/op_xrds.aspx
deleted file mode 100644
index b906bfe..0000000
--- a/samples/ProviderCustomStore/op_xrds.aspx
+++ /dev/null
@@ -1,19 +0,0 @@
-<%@ Page Language="C#" AutoEventWireup="true" ContentType="application/xrds+xml" %><?xml version="1.0" encoding="UTF-8"?>
-<%--
-This page is a required as part of the service discovery phase of the openid
-protocol (step 1). It simply renders the xml for doing service discovery of
-server.aspx using the xrds mechanism.
-This XRDS doc is discovered via the user.aspx page.
---%>
-<xrds:XRDS
- xmlns:xrds="xri://$xrds"
- xmlns:openid="http://openid.net/xmlns/1.0"
- xmlns="xri://$xrd*($v*2.0)">
- <XRD>
- <Service priority="10">
- <Type>http://specs.openid.net/auth/2.0/server</Type>
- <Type>http://openid.net/extensions/sreg/1.1</Type>
- <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/server.aspx"))%></URI>
- </Service>
- </XRD>
-</xrds:XRDS>
diff --git a/samples/ProviderCustomStore/user.aspx b/samples/ProviderCustomStore/user.aspx
deleted file mode 100644
index 033af02..0000000
--- a/samples/ProviderCustomStore/user.aspx
+++ /dev/null
@@ -1,17 +0,0 @@
-<%@ Page Language="C#" AutoEventWireup="true" %>
-
-<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId.Provider" TagPrefix="openid" %>
-<html>
-<head>
- <openid:IdentityEndpoint ID="IdentityEndpoint20" runat="server" ProviderEndpointUrl="~/Server.aspx"
- XrdsUrl="~/user_xrds.aspx" ProviderVersion="V20" />
- <!-- and for backward compatibility with OpenID 1.x RPs... -->
- <openid:IdentityEndpoint ID="IdentityEndpoint11" runat="server" ProviderEndpointUrl="~/Server.aspx"
- ProviderVersion="V11" />
-</head>
-<body>
- <p>
- OpenID identity page for <%=Request.QueryString["username"]%>
- </p>
-</body>
-</html>
diff --git a/samples/ProviderCustomStore/user_xrds.aspx b/samples/ProviderCustomStore/user_xrds.aspx
deleted file mode 100644
index 56b1244..0000000
--- a/samples/ProviderCustomStore/user_xrds.aspx
+++ /dev/null
@@ -1,24 +0,0 @@
-<%@ Page Language="C#" AutoEventWireup="true" ContentType="application/xrds+xml" %><?xml version="1.0" encoding="UTF-8"?>
-<%--
-This page is a required as part of the service discovery phase of the openid
-protocol (step 1). It simply renders the xml for doing service discovery of
-server.aspx using the xrds mechanism.
-This XRDS doc is discovered via the user.aspx page.
---%>
-<xrds:XRDS
- xmlns:xrds="xri://$xrds"
- xmlns:openid="http://openid.net/xmlns/1.0"
- xmlns="xri://$xrd*($v*2.0)">
- <XRD>
- <Service priority="10">
- <Type>http://specs.openid.net/auth/2.0/signon</Type>
- <Type>http://openid.net/extensions/sreg/1.1</Type>
- <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/server.aspx"))%></URI>
- </Service>
- <Service priority="20">
- <Type>http://openid.net/signon/1.0</Type>
- <Type>http://openid.net/extensions/sreg/1.1</Type>
- <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/server.aspx"))%></URI>
- </Service>
- </XRD>
-</xrds:XRDS>
diff --git a/samples/ProviderCustomStore/CustomStore.cs b/samples/ProviderPortal/Code/CustomStore.cs
index 5b25ba4..de7043f 100644
--- a/samples/ProviderCustomStore/CustomStore.cs
+++ b/samples/ProviderPortal/Code/CustomStore.cs
@@ -6,7 +6,7 @@ using DotNetOpenId;
using DotNetOpenId.RelyingParty;
using IProviderAssociationStore = DotNetOpenId.IAssociationStore<DotNetOpenId.AssociationRelyingPartyType>;
-namespace ProviderCustomStore {
+namespace ProviderPortal.Code {
/// <summary>
/// This custom store serializes all elements to demonstrate peristent and/or shared storage.
/// This is common in a web farm, for example.
@@ -18,8 +18,7 @@ namespace ProviderCustomStore {
/// that using a database is possible.
/// </remarks>
public class CustomStore : IProviderAssociationStore {
- public static CustomStore Instance = new CustomStore();
- public CustomStoreDataSet dataSet = new CustomStoreDataSet();
+ static CustomStoreDataSet dataSet = new CustomStoreDataSet();
#region IAssociationStore<AssociationRelyingPartyType> Members
diff --git a/samples/ProviderCustomStore/CustomStoreDataSet.Designer.cs b/samples/ProviderPortal/Code/CustomStoreDataSet.Designer.cs
index 87e5c13..6fbe114 100644
--- a/samples/ProviderCustomStore/CustomStoreDataSet.Designer.cs
+++ b/samples/ProviderPortal/Code/CustomStoreDataSet.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.1434
+// Runtime Version:2.0.50727.3053
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -10,7 +10,7 @@
#pragma warning disable 1591
-namespace ProviderCustomStore {
+namespace ProviderPortal.Code {
/// <summary>
diff --git a/samples/ProviderCustomStore/CustomStoreDataSet.xsc b/samples/ProviderPortal/Code/CustomStoreDataSet.xsc
index 551fc56..551fc56 100644
--- a/samples/ProviderCustomStore/CustomStoreDataSet.xsc
+++ b/samples/ProviderPortal/Code/CustomStoreDataSet.xsc
diff --git a/samples/ProviderCustomStore/CustomStoreDataSet.xsd b/samples/ProviderPortal/Code/CustomStoreDataSet.xsd
index 47f68e8..47f68e8 100644
--- a/samples/ProviderCustomStore/CustomStoreDataSet.xsd
+++ b/samples/ProviderPortal/Code/CustomStoreDataSet.xsd
diff --git a/samples/ProviderCustomStore/CustomStoreDataSet.xss b/samples/ProviderPortal/Code/CustomStoreDataSet.xss
index d097e67..d097e67 100644
--- a/samples/ProviderCustomStore/CustomStoreDataSet.xss
+++ b/samples/ProviderPortal/Code/CustomStoreDataSet.xss
diff --git a/samples/ProviderPortal/Code/Util.cs b/samples/ProviderPortal/Code/Util.cs
index 982748c..f864972 100644
--- a/samples/ProviderPortal/Code/Util.cs
+++ b/samples/ProviderPortal/Code/Util.cs
@@ -19,6 +19,29 @@ public class Util {
return ExtractUserName(new Uri(identifier.ToString()));
}
public static Identifier BuildIdentityUrl() {
- return new Uri(HttpContext.Current.Request.Url, "/user/" + HttpContext.Current.User.Identity.Name);
+ string username = HttpContext.Current.User.Identity.Name;
+ // be sure to normalize case the way the user's identity page does.
+ username = username.Substring(0, 1).ToUpperInvariant() + username.Substring(1).ToLowerInvariant();
+ return new Uri(HttpContext.Current.Request.Url, "/user/" + username);
+ }
+ internal static void ProcessAuthenticationChallenge(IAuthenticationRequest idrequest) {
+ if (idrequest.Immediate) {
+ if (idrequest.IsDirectedIdentity) {
+ if (HttpContext.Current.User.Identity.IsAuthenticated) {
+ idrequest.LocalIdentifier = Util.BuildIdentityUrl();
+ idrequest.IsAuthenticated = true;
+ } else {
+ idrequest.IsAuthenticated = false;
+ }
+ } else {
+ string userOwningOpenIdUrl = Util.ExtractUserName(idrequest.LocalIdentifier);
+ // NOTE: in a production provider site, you may want to only
+ // respond affirmatively if the user has already authorized this consumer
+ // to know the answer.
+ idrequest.IsAuthenticated = userOwningOpenIdUrl == HttpContext.Current.User.Identity.Name;
+ }
+ } else {
+ HttpContext.Current.Response.Redirect("~/decide.aspx", true);
+ }
}
}
diff --git a/samples/ProviderPortal/Global.asax.cs b/samples/ProviderPortal/Global.asax.cs
index 599bae2..091ea56 100644
--- a/samples/ProviderPortal/Global.asax.cs
+++ b/samples/ProviderPortal/Global.asax.cs
@@ -8,11 +8,6 @@ namespace ProviderPortal {
public class Global : System.Web.HttpApplication {
internal static StringBuilder LogMessages = new StringBuilder();
- public Global() {
- // since this is a sample, and will often be used with localhost
- DotNetOpenId.UntrustedWebRequest.WhitelistHosts.Add("localhost");
- }
-
public static log4net.ILog Logger = log4net.LogManager.GetLogger(typeof(Global));
protected void Application_Start(object sender, EventArgs e) {
diff --git a/samples/ProviderPortal/Provider.ashx b/samples/ProviderPortal/Provider.ashx
new file mode 100644
index 0000000..27475cc
--- /dev/null
+++ b/samples/ProviderPortal/Provider.ashx
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="Provider.ashx.cs" Class="ProviderPortal.Provider" %>
diff --git a/samples/ProviderPortal/Provider.ashx.cs b/samples/ProviderPortal/Provider.ashx.cs
new file mode 100644
index 0000000..7e2e749
--- /dev/null
+++ b/samples/ProviderPortal/Provider.ashx.cs
@@ -0,0 +1,62 @@
+using System.Web;
+using System.Web.SessionState;
+using DotNetOpenId.Provider;
+
+namespace ProviderPortal {
+ /// <summary>
+ /// A fast OpenID message handler that responds to OpenID messages
+ /// directed at the Provider.
+ /// </summary>
+ /// <remarks>
+ /// This performs the same function as server.aspx, which uses the ProviderEndpoint
+ /// control to reduce the amount of source code in the web site. A typical Provider
+ /// site will have EITHER this .ashx handler OR the .aspx page -- NOT both.
+ /// </remarks>
+ public class Provider : IHttpHandler, IRequiresSessionState {
+ const string pendingAuthenticationRequestKey = "pendingAuthenticationRequestKey";
+ internal static IAuthenticationRequest PendingAuthenticationRequest {
+ get { return HttpContext.Current.Session[pendingAuthenticationRequestKey] as IAuthenticationRequest; }
+ set { HttpContext.Current.Session[pendingAuthenticationRequestKey] = value; }
+ }
+
+ public void ProcessRequest(HttpContext context) {
+ OpenIdProvider provider = new OpenIdProvider();
+ if (provider.Request != null) {
+ // Some OpenID requests are automatable and can be responded to immediately.
+ if (!provider.Request.IsResponseReady) {
+ // But authentication requests cannot be responded to until something on
+ // this site decides whether to approve or disapprove the authentication.
+ var idrequest = (IAuthenticationRequest)provider.Request;
+ // We store the authentication request in the user's session so that
+ // redirects and user prompts can appear and eventually some page can decide
+ // to respond to the OpenID authentication request either affirmatively or
+ // negatively.
+ PendingAuthenticationRequest = idrequest;
+ // We delegate that approval process to our utility method that we share
+ // with our other Provider sample page server.aspx.
+ Util.ProcessAuthenticationChallenge(idrequest);
+ // As part of authentication approval, the user may need to authenticate
+ // to this Provider and/or decide whether to allow the requesting RP site
+ // to log this user in. If any UI needs to be presented to the user,
+ // the previous call to ProcessAuthenticationChallenge MAY not return
+ // due to a redirect to some ASPX page.
+ } else {
+ // Some other automatable OpenID request is coming down, so clear
+ // any previously session stored authentication request that might be
+ // stored for this user.
+ PendingAuthenticationRequest = null;
+ }
+ // Whether this was an automated message or an authentication message,
+ // if there is a response ready to send back immediately, do so.
+ if (provider.Request.IsResponseReady) {
+ provider.Request.Response.Send();
+ PendingAuthenticationRequest = null;
+ }
+ }
+ }
+
+ public bool IsReusable {
+ get { return true; }
+ }
+ }
+}
diff --git a/samples/ProviderPortal/ProviderPortal.csproj b/samples/ProviderPortal/ProviderPortal.csproj
index cd8e45b..f39b097 100644
--- a/samples/ProviderPortal/ProviderPortal.csproj
+++ b/samples/ProviderPortal/ProviderPortal.csproj
@@ -58,6 +58,12 @@
<Content Include="user_xrds.aspx" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Code\CustomStore.cs" />
+ <Compile Include="Code\CustomStoreDataSet.Designer.cs">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ </Compile>
<Compile Include="Code\ReadOnlyXmlMembershipProvider.cs" />
<Compile Include="Code\TracePageAppender.cs" />
<Compile Include="Code\URLRewriter.cs" />
@@ -87,6 +93,9 @@
<DependentUpon>ProfileFields.ascx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Provider.ashx.cs">
+ <DependentUpon>Provider.ashx</DependentUpon>
+ </Compile>
<Compile Include="server.aspx.cs">
<DependentUpon>server.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -122,6 +131,20 @@
<Content Include="styles.css" />
<Content Include="TracePage.aspx" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="Code\CustomStoreDataSet.xsc">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ </None>
+ <None Include="Code\CustomStoreDataSet.xsd">
+ <Generator>MSDataSetGenerator</Generator>
+ <LastGenOutput>CustomStoreDataSet.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </None>
+ <None Include="Code\CustomStoreDataSet.xss">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ </None>
+ <Content Include="Provider.ashx" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/samples/ProviderPortal/Web.config b/samples/ProviderPortal/Web.config
index a667724..c27f8bc 100644
--- a/samples/ProviderPortal/Web.config
+++ b/samples/ProviderPortal/Web.config
@@ -11,7 +11,24 @@
<configSections>
<section name="urlrewrites" type="ProviderPortal.URLRewriter" requirePermission="false"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" />
+ <sectionGroup name="dotNetOpenId">
+ <section name="relyingParty" type="DotNetOpenId.Configuration.RelyingPartySection" requirePermission="false" allowLocation="true"/>
+ <section name="provider" type="DotNetOpenId.Configuration.ProviderSection" requirePermission="false" allowLocation="true"/>
+ <section name="untrustedWebRequest" type="DotNetOpenId.Configuration.UntrustedWebRequestSection" requirePermission="false" allowLocation="false"/>
+ </sectionGroup>
</configSections>
+ <dotNetOpenId>
+ <provider>
+ <!-- Uncomment the following to activate the sample custom store. -->
+ <!--<store type="ProviderPortal.Code.CustomStore, ProviderPortal" />-->
+ </provider>
+ <untrustedWebRequest>
+ <whitelistHosts>
+ <!-- since this is a sample, and will often be used with localhost -->
+ <add name="localhost" />
+ </whitelistHosts>
+ </untrustedWebRequest>
+ </dotNetOpenId>
<connectionStrings/>
<!--
Original version created by Richard Birkby (2002-02-22, http://www.codeproject.com/aspnet/URLRewriter.asp)
diff --git a/samples/ProviderPortal/decide.aspx.cs b/samples/ProviderPortal/decide.aspx.cs
index 1e1f95d..db381ac 100644
--- a/samples/ProviderPortal/decide.aspx.cs
+++ b/samples/ProviderPortal/decide.aspx.cs
@@ -23,7 +23,7 @@ public partial class decide : Page {
realmLabel.Text = ProviderEndpoint.PendingAuthenticationRequest.Realm.ToString();
// check that the logged in user is the same as the user requesting authentication to the consumer. If not, then log them out.
- if (User.Identity.Name == Util.ExtractUserName(ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier)) {
+ if (String.Equals(User.Identity.Name, Util.ExtractUserName(ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier), StringComparison.OrdinalIgnoreCase)) {
// if simple registration fields were used, then prompt the user for them
var requestedFields = ProviderEndpoint.PendingAuthenticationRequest.GetExtension<ClaimsRequest>();
if (requestedFields != null) {
@@ -43,9 +43,14 @@ public partial class decide : Page {
protected void Yes_Click(Object sender, EventArgs e) {
var sregRequest = ProviderEndpoint.PendingAuthenticationRequest.GetExtension<ClaimsRequest>();
- var sregResponse = profileFields.GetOpenIdProfileFields(sregRequest);
+ ClaimsResponse sregResponse = null;
+ if (sregRequest != null) {
+ sregResponse = profileFields.GetOpenIdProfileFields(sregRequest);
+ }
ProviderEndpoint.PendingAuthenticationRequest.IsAuthenticated = true;
- ProviderEndpoint.PendingAuthenticationRequest.AddResponseExtension(sregResponse);
+ if (sregResponse != null) {
+ ProviderEndpoint.PendingAuthenticationRequest.AddResponseExtension(sregResponse);
+ }
Debug.Assert(ProviderEndpoint.PendingAuthenticationRequest.IsResponseReady);
ProviderEndpoint.PendingAuthenticationRequest.Response.Send();
ProviderEndpoint.PendingAuthenticationRequest = null;
diff --git a/samples/ProviderPortal/server.aspx b/samples/ProviderPortal/server.aspx
index 318df4a..e67a7ba 100644
--- a/samples/ProviderPortal/server.aspx
+++ b/samples/ProviderPortal/server.aspx
@@ -7,6 +7,13 @@
</head>
<body>
<form runat='server'>
+ <%-- This page provides an example of how to use the ProviderEndpoint control on an ASPX page
+ to host an OpenID Provider. Alternatively for greater performance an .ashx file can be used.
+ See Provider.ashx for an example. A typical web site will NOT use both .ashx and .aspx
+ provider endpoints.
+ This server.aspx page is the default provider endpoint to use. To switch to the .ashx handler,
+ change the user_xrds.aspx and op_xrds.aspx files to point to provider.ashx instead of server.aspx.
+ --%>
<openid:ProviderEndpoint runat="server" OnAuthenticationChallenge="provider_AuthenticationChallenge" />
<p>
<asp:Label ID="serverEndpointUrl" runat="server" EnableViewState="false" />
diff --git a/samples/ProviderPortal/server.aspx.cs b/samples/ProviderPortal/server.aspx.cs
index 8589f40..fbc9a6c 100644
--- a/samples/ProviderPortal/server.aspx.cs
+++ b/samples/ProviderPortal/server.aspx.cs
@@ -10,24 +10,6 @@ public partial class server : System.Web.UI.Page {
serverEndpointUrl.Text = Request.Url.ToString();
}
protected void provider_AuthenticationChallenge(object sender, AuthenticationChallengeEventArgs e) {
- var idrequest = e.Request;
- if (idrequest.Immediate) {
- if (idrequest.IsDirectedIdentity) {
- if (User.Identity.IsAuthenticated) {
- idrequest.LocalIdentifier = Util.BuildIdentityUrl();
- idrequest.IsAuthenticated = true;
- } else {
- idrequest.IsAuthenticated = false;
- }
- } else {
- string userOwningOpenIdUrl = Util.ExtractUserName(idrequest.LocalIdentifier);
- // NOTE: in a production provider site, you may want to only
- // respond affirmatively if the user has already authorized this consumer
- // to know the answer.
- idrequest.IsAuthenticated = userOwningOpenIdUrl == User.Identity.Name;
- }
- } else {
- Response.Redirect("~/decide.aspx", true); // This ends processing on this page.
- }
+ Util.ProcessAuthenticationChallenge(e.Request);
}
} \ No newline at end of file
diff --git a/samples/ProviderPortal/server.aspx.designer.cs b/samples/ProviderPortal/server.aspx.designer.cs
index 16dd628..90203b1 100644
--- a/samples/ProviderPortal/server.aspx.designer.cs
+++ b/samples/ProviderPortal/server.aspx.designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.1434
+// Runtime Version:2.0.50727.3053
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
diff --git a/samples/ProviderPortal/user.aspx b/samples/ProviderPortal/user.aspx
index 68bccbc..fc3716f 100644
--- a/samples/ProviderPortal/user.aspx
+++ b/samples/ProviderPortal/user.aspx
@@ -1,9 +1,10 @@
<%@ Page Language="C#" AutoEventWireup="true" Inherits="user" CodeBehind="user.aspx.cs" MasterPageFile="~/Site.Master" %>
<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId.Provider" TagPrefix="openid" %>
-<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="Head">
+<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="head">
<openid:IdentityEndpoint ID="IdentityEndpoint20" runat="server" ProviderEndpointUrl="~/Server.aspx"
- XrdsUrl="~/user_xrds.aspx" ProviderVersion="V20" />
+ XrdsUrl="~/user_xrds.aspx" ProviderVersion="V20"
+ AutoNormalizeRequest="true" OnNormalizeUri="IdentityEndpoint20_NormalizeUri" />
<!-- and for backward compatibility with OpenID 1.x RPs... -->
<openid:IdentityEndpoint ID="IdentityEndpoint11" runat="server" ProviderEndpointUrl="~/Server.aspx"
ProviderVersion="V11" />
diff --git a/samples/ProviderPortal/user.aspx.cs b/samples/ProviderPortal/user.aspx.cs
index 5400200..744cae5 100644
--- a/samples/ProviderPortal/user.aspx.cs
+++ b/samples/ProviderPortal/user.aspx.cs
@@ -1,5 +1,5 @@
using System;
-using System.Configuration;
+using DotNetOpenId.Provider;
/// <summary>
/// This page is a required as part of the service discovery phase of the openid protocol (step 1).
@@ -18,4 +18,15 @@ public partial class user : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
usernameLabel.Text = Request.QueryString["username"];
}
+
+ protected void IdentityEndpoint20_NormalizeUri(object sender, IdentityEndpointNormalizationEventArgs e) {
+ // This sample Provider has a custom policy for normalizing URIs, which is that the whole
+ // path of the URI be lowercase except for the first letter of the username.
+ UriBuilder normalized = new UriBuilder(e.UserSuppliedIdentifier);
+ string username = Request.QueryString["username"].TrimEnd('/').ToLowerInvariant();
+ username = username.Substring(0, 1).ToUpperInvariant() + username.Substring(1);
+ normalized.Path = "/user/" + username;
+ normalized.Scheme = "http"; // for a real Provider, this should be HTTPS if supported.
+ e.NormalizedIdentifier = normalized.Uri;
+ }
}
diff --git a/samples/RelyingPartyCustomStore/.gitignore b/samples/RelyingPartyCustomStore/.gitignore
deleted file mode 100644
index 0986274..0000000
--- a/samples/RelyingPartyCustomStore/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Bin
-obj
-*Trace.txt
-*.user
diff --git a/samples/RelyingPartyCustomStore/Default.aspx b/samples/RelyingPartyCustomStore/Default.aspx
deleted file mode 100644
index 445b3a9..0000000
--- a/samples/RelyingPartyCustomStore/Default.aspx
+++ /dev/null
@@ -1,30 +0,0 @@
-<%@ Page Language="C#" AutoEventWireup="true" %>
-
-<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId" TagPrefix="openid" %>
-<!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 id="Head1" runat="server">
- <title>OpenID Relying Party, by DotNetOpenId</title>
- <openid:XrdsPublisher runat="server" XrdsUrl="~/xrds.aspx" />
-</head>
-<body>
- <form id="form1" runat="server">
- <h1>
- OpenID Relying Party, with custom store
- </h1>
- <h2>
- Provided by <a href="http://dotnetopenid.googlecode.com">DotNetOpenId</a>
- </h2>
- <p>
- This sample implements a custom store for associations and nonces, which can be useful
- when deploying a relying party site on a web farm.
- </p>
- <p>
- Visit the
- <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/MembersOnly/Default.aspx"
- Text="Members Only" />
- area. (This will trigger a login demo).
- </p>
- </form>
-</body>
-</html>
diff --git a/samples/RelyingPartyCustomStore/Global.asax b/samples/RelyingPartyCustomStore/Global.asax
deleted file mode 100644
index a00a077..0000000
--- a/samples/RelyingPartyCustomStore/Global.asax
+++ /dev/null
@@ -1 +0,0 @@
-<%@ Application Codebehind="Global.asax.cs" Inherits="RelyingPartyCustomStore.Global" Language="C#" %>
diff --git a/samples/RelyingPartyCustomStore/Global.asax.cs b/samples/RelyingPartyCustomStore/Global.asax.cs
deleted file mode 100644
index b8b7593..0000000
--- a/samples/RelyingPartyCustomStore/Global.asax.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections;
-using System.Configuration;
-using System.Data;
-using System.Web;
-using System.Web.Security;
-using System.Web.SessionState;
-
-namespace RelyingPartyCustomStore {
- public class Global : System.Web.HttpApplication {
- public Global() {
- // since this is a sample, and will often be used with localhost
- DotNetOpenId.UntrustedWebRequest.WhitelistHosts.Add("localhost");
- }
- }
-} \ No newline at end of file
diff --git a/samples/RelyingPartyCustomStore/MembersOnly/Default.aspx b/samples/RelyingPartyCustomStore/MembersOnly/Default.aspx
deleted file mode 100644
index ae974cc..0000000
--- a/samples/RelyingPartyCustomStore/MembersOnly/Default.aspx
+++ /dev/null
@@ -1,21 +0,0 @@
-<%@ Page Language="C#" AutoEventWireup="true" %>
-
-<!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>Welcome OpenID User!</title>
-</head>
-<body>
- <form id="form1" runat="server">
- <h1>
- Members Only Area
- </h1>
- <p>
- Congratulations, <b>
- <asp:LoginName ID="LoginName1" runat="server" />
- </b>. You have completed the OpenID login process.
- </p>
- <asp:LoginStatus ID="LoginStatus1" runat="server" />
- </form>
-</body>
-</html>
diff --git a/samples/RelyingPartyCustomStore/MembersOnly/Web.config b/samples/RelyingPartyCustomStore/MembersOnly/Web.config
deleted file mode 100644
index 7fbfa59..0000000
--- a/samples/RelyingPartyCustomStore/MembersOnly/Web.config
+++ /dev/null
@@ -1,18 +0,0 @@
-<?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>
- <appSettings/>
- <connectionStrings/>
- <system.web>
- <authorization>
- <deny users="?"/>
- </authorization>
- </system.web>
-</configuration>
diff --git a/samples/RelyingPartyCustomStore/Properties/AssemblyInfo.cs b/samples/RelyingPartyCustomStore/Properties/AssemblyInfo.cs
deleted file mode 100644
index 7ff8c9b..0000000
--- a/samples/RelyingPartyCustomStore/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("RelyingPartyCustomStore")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("RelyingPartyCustomStore")]
-[assembly: AssemblyCopyright("Copyright © 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/samples/RelyingPartyCustomStore/RelyingPartyCustomStore.csproj b/samples/RelyingPartyCustomStore/RelyingPartyCustomStore.csproj
deleted file mode 100644
index 2519ec1..0000000
--- a/samples/RelyingPartyCustomStore/RelyingPartyCustomStore.csproj
+++ /dev/null
@@ -1,116 +0,0 @@
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{DB54DC19-BA56-4C22-A8A0-C49289EA4F53}</ProjectGuid>
- <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>RelyingPartyCustomStore</RootNamespace>
- <AssemblyName>RelyingPartyCustomStore</AssemblyName>
- <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Drawing" />
- <Reference Include="System.Web" />
- <Reference Include="System.Xml" />
- <Reference Include="System.Configuration" />
- <Reference Include="System.Web.Services" />
- <Reference Include="System.EnterpriseServices" />
- <Reference Include="System.Web.Mobile" />
- </ItemGroup>
- <ItemGroup>
- <Content Include="Default.aspx" />
- <Content Include="login.aspx" />
- <Content Include="MembersOnly\Default.aspx" />
- <Content Include="Web.config" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CustomStore.cs" />
- <Compile Include="CustomStoreDataSet.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
- </Compile>
- <Compile Include="Global.asax.cs">
- <DependentUpon>Global.asax</DependentUpon>
- </Compile>
- <Compile Include="login.aspx.cs">
- <DependentUpon>login.aspx</DependentUpon>
- <SubType>ASPXCodeBehind</SubType>
- </Compile>
- <Compile Include="login.aspx.designer.cs">
- <DependentUpon>login.aspx</DependentUpon>
- </Compile>
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\src\DotNetOpenId\DotNetOpenId.csproj">
- <Project>{5D6EDC86-F5B2-4786-8376-4E7C24C63D39}</Project>
- <Name>DotNetOpenId</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Content Include="Global.asax" />
- <Content Include="MembersOnly\Web.config" />
- </ItemGroup>
- <ItemGroup>
- <None Include="CustomStoreDataSet.xsc">
- <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
- </None>
- <None Include="CustomStoreDataSet.xsd">
- <SubType>Designer</SubType>
- <Generator>MSDataSetGenerator</Generator>
- <LastGenOutput>CustomStoreDataSet.Designer.cs</LastGenOutput>
- </None>
- <None Include="CustomStoreDataSet.xss">
- <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
- </None>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <ProjectExtensions>
- <VisualStudio>
- <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
- <WebProjectProperties>
- <UseIIS>False</UseIIS>
- <AutoAssignPort>True</AutoAssignPort>
- <DevelopmentServerPort>6945</DevelopmentServerPort>
- <DevelopmentServerVPath>/</DevelopmentServerVPath>
- <IISUrl>
- </IISUrl>
- <NTLMAuthentication>False</NTLMAuthentication>
- <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
- </WebProjectProperties>
- </FlavorProperties>
- </VisualStudio>
- </ProjectExtensions>
-</Project> \ No newline at end of file
diff --git a/samples/RelyingPartyCustomStore/Web.config b/samples/RelyingPartyCustomStore/Web.config
deleted file mode 100644
index d5574f5..0000000
--- a/samples/RelyingPartyCustomStore/Web.config
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<configuration>
- <system.web>
- <compilation debug="true"/>
- <customErrors mode="RemoteOnly"/>
- <authentication mode="Forms">
- <forms name="RelyingPartyCustomStoreSession"/> <!-- named cookie prevents conflicts with other samples -->
- </authentication>
- <trace enabled="false" writeToDiagnosticsTrace="true" />
- <!-- Trust level discussion:
- Full: everything works
- High: TRACE compilation symbol must NOT be defined
- Medium/Low: doesn't work on default machine.config, because WebPermission.Connect is denied.
- -->
- <trust level="Full" originUrl=""/>
- </system.web>
- <system.diagnostics>
- <switches>
- <!-- Disabled tracing because it breaks WebResource.axd, which downloads the OpenID logo. -->
- <!--<add name="OpenID" value="4"/>-->
- </switches>
- <trace autoflush="true" indentsize="4">
- <listeners>
- <add name="fileLogger" type="System.Diagnostics.TextWriterTraceListener"
- initializeData="openidConsumerTrace.txt" traceOutputOptions="None"/>
- </listeners>
- </trace>
- </system.diagnostics>
-</configuration>
diff --git a/samples/RelyingPartyCustomStore/login.aspx b/samples/RelyingPartyCustomStore/login.aspx
deleted file mode 100644
index d04ec0a..0000000
--- a/samples/RelyingPartyCustomStore/login.aspx
+++ /dev/null
@@ -1,24 +0,0 @@
-<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="login.aspx.cs" Inherits="login" ValidateRequest="false" %>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>Login</title>
-</head>
-<body>
- <form id="Form1" runat="server">
- <h2>
- Login Page
- </h2>
- <asp:Label ID="Label1" runat="server" Text="OpenID Login" />
- <asp:TextBox ID="openIdBox" runat="server" />
- <asp:Button ID="loginButton" runat="server" Text="Login"
- onclick="loginButton_Click" />
- <br />
- <asp:Label ID="loginFailedLabel" runat="server" EnableViewState="False" Text="Login failed"
- Visible="False" />
- <asp:Label ID="loginCanceledLabel" runat="server" EnableViewState="False" Text="Login canceled"
- Visible="False" />
- </form>
-</body>
-</html>
diff --git a/samples/RelyingPartyCustomStore/login.aspx.cs b/samples/RelyingPartyCustomStore/login.aspx.cs
deleted file mode 100644
index f7b1088..0000000
--- a/samples/RelyingPartyCustomStore/login.aspx.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Web.UI;
-using DotNetOpenId.RelyingParty;
-using System.Web.Security;
-using RelyingPartyCustomStore;
-
-public partial class login : System.Web.UI.Page {
- protected void Page_Load(object sender, EventArgs e) {
- openIdBox.Focus();
-
- OpenIdRelyingParty rp = new OpenIdRelyingParty(CustomStore.Instance, Request.Url,
- Request.HttpMethod == "GET" ? Request.QueryString : Request.Form);
- if (rp.Response != null) {
- switch (rp.Response.Status) {
- case AuthenticationStatus.Authenticated:
- FormsAuthentication.RedirectFromLoginPage(rp.Response.ClaimedIdentifier, false);
- break;
- case AuthenticationStatus.Canceled:
- loginCanceledLabel.Visible = true;
- break;
- case AuthenticationStatus.Failed:
- loginFailedLabel.Visible = true;
- break;
- }
- }
- }
-
- protected void loginButton_Click(object sender, EventArgs e) {
- OpenIdRelyingParty rp = new OpenIdRelyingParty(CustomStore.Instance, Request.Url,
- Request.HttpMethod == "GET" ? Request.QueryString : Request.Form);
- rp.CreateRequest(openIdBox.Text).RedirectToProvider();
- }
-}
diff --git a/samples/RelyingPartyCustomStore/login.aspx.designer.cs b/samples/RelyingPartyCustomStore/login.aspx.designer.cs
deleted file mode 100644
index b5a6e1f..0000000
--- a/samples/RelyingPartyCustomStore/login.aspx.designer.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.1434
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-
-
-public partial class login {
-
- /// <summary>
- /// Form1 control.
- /// </summary>
- /// <remarks>
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- /// </remarks>
- protected global::System.Web.UI.HtmlControls.HtmlForm Form1;
-
- /// <summary>
- /// Label1 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 Label1;
-
- /// <summary>
- /// openIdBox 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.TextBox openIdBox;
-
- /// <summary>
- /// loginButton 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 loginButton;
-
- /// <summary>
- /// loginFailedLabel 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 loginFailedLabel;
-
- /// <summary>
- /// loginCanceledLabel 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 loginCanceledLabel;
-}
diff --git a/samples/RelyingPartyMvc/Global.asax.cs b/samples/RelyingPartyMvc/Global.asax.cs
index 0f0b4ef..0659169 100644
--- a/samples/RelyingPartyMvc/Global.asax.cs
+++ b/samples/RelyingPartyMvc/Global.asax.cs
@@ -7,11 +7,6 @@ using System.Web.Routing;
namespace RelyingPartyMvc {
public class GlobalApplication : System.Web.HttpApplication {
- public GlobalApplication() {
- // since this is a sample, and will often be used with localhost
- DotNetOpenId.UntrustedWebRequest.WhitelistHosts.Add("localhost");
- }
-
public static void RegisterRoutes(RouteCollection routes) {
// Note: Change the URL to "{controller}.mvc/{action}/{id}" to enable
// automatic support on IIS6 and IIS7 classic mode
diff --git a/samples/RelyingPartyMvc/Web.config b/samples/RelyingPartyMvc/Web.config
index fc256b8..d72528a 100644
--- a/samples/RelyingPartyMvc/Web.config
+++ b/samples/RelyingPartyMvc/Web.config
@@ -9,6 +9,11 @@
-->
<configuration>
<configSections>
+ <sectionGroup name="dotNetOpenId">
+ <section name="relyingParty" type="DotNetOpenId.Configuration.RelyingPartySection" requirePermission="false" allowLocation="true"/>
+ <section name="provider" type="DotNetOpenId.Configuration.ProviderSection" requirePermission="false" allowLocation="true"/>
+ <section name="untrustedWebRequest" type="DotNetOpenId.Configuration.UntrustedWebRequestSection" requirePermission="false" allowLocation="false"/>
+ </sectionGroup>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
@@ -21,6 +26,14 @@
</sectionGroup>
</sectionGroup>
</configSections>
+ <dotNetOpenId>
+ <untrustedWebRequest>
+ <whitelistHosts>
+ <!-- since this is a sample, and will often be used with localhost -->
+ <add name="localhost" />
+ </whitelistHosts>
+ </untrustedWebRequest>
+ </dotNetOpenId>
<appSettings/>
<connectionStrings/>
<system.web>
diff --git a/samples/RelyingPartyCustomStore/CustomStore.cs b/samples/RelyingPartyPortal/Code/CustomStore.cs
index b0e3700..0083152 100644
--- a/samples/RelyingPartyCustomStore/CustomStore.cs
+++ b/samples/RelyingPartyPortal/Code/CustomStore.cs
@@ -5,7 +5,7 @@ using System.Security.Cryptography;
using DotNetOpenId;
using DotNetOpenId.RelyingParty;
-namespace RelyingPartyCustomStore {
+namespace ConsumerPortal.Code {
/// <summary>
/// This custom store serializes all elements to demonstrate peristent and/or shared storage.
/// This is common in a web farm, for example.
@@ -17,8 +17,7 @@ namespace RelyingPartyCustomStore {
/// that using a database is possible.
/// </remarks>
public class CustomStore : IRelyingPartyApplicationStore {
- public static CustomStore Instance = new CustomStore();
- public CustomStoreDataSet dataSet = new CustomStoreDataSet();
+ static CustomStoreDataSet dataSet = new CustomStoreDataSet();
#region IAssociationStore<Uri> Members
@@ -66,7 +65,7 @@ namespace RelyingPartyCustomStore {
#region INonceStore Members
- byte[] secretSigningKey;
+ static byte[] secretSigningKey;
public byte[] SecretSigningKey {
get {
if (secretSigningKey == null) {
@@ -75,7 +74,7 @@ namespace RelyingPartyCustomStore {
// initialize in a local variable before setting in field for thread safety.
byte[] auth_key = new byte[64];
new RNGCryptoServiceProvider().GetBytes(auth_key);
- this.secretSigningKey = auth_key;
+ CustomStore.secretSigningKey = auth_key;
}
}
}
@@ -115,6 +114,5 @@ namespace RelyingPartyCustomStore {
for (int i = view.Count - 1; i >= 0; i--)
view.Delete(i);
}
-
}
}
diff --git a/samples/RelyingPartyCustomStore/CustomStoreDataSet.Designer.cs b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.Designer.cs
index b757e71..5b7c03e 100644
--- a/samples/RelyingPartyCustomStore/CustomStoreDataSet.Designer.cs
+++ b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.1434
+// Runtime Version:2.0.50727.3053
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -10,7 +10,7 @@
#pragma warning disable 1591
-namespace RelyingPartyCustomStore {
+namespace ConsumerPortal.Code {
/// <summary>
diff --git a/samples/RelyingPartyPortal/Code/CustomStoreDataSet.cs b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.cs
new file mode 100644
index 0000000..d53f870
--- /dev/null
+++ b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.cs
@@ -0,0 +1,6 @@
+namespace ConsumerPortal.Code {
+
+
+ public partial class CustomStoreDataSet {
+ }
+}
diff --git a/samples/RelyingPartyCustomStore/CustomStoreDataSet.xsc b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsc
index 551fc56..551fc56 100644
--- a/samples/RelyingPartyCustomStore/CustomStoreDataSet.xsc
+++ b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsc
diff --git a/samples/RelyingPartyCustomStore/CustomStoreDataSet.xsd b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsd
index 76b77aa..76b77aa 100644
--- a/samples/RelyingPartyCustomStore/CustomStoreDataSet.xsd
+++ b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsd
diff --git a/samples/RelyingPartyCustomStore/CustomStoreDataSet.xss b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xss
index fbe7113..fbe7113 100644
--- a/samples/RelyingPartyCustomStore/CustomStoreDataSet.xss
+++ b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xss
diff --git a/samples/RelyingPartyPortal/Global.asax.cs b/samples/RelyingPartyPortal/Global.asax.cs
index 259512f..eb61da9 100644
--- a/samples/RelyingPartyPortal/Global.asax.cs
+++ b/samples/RelyingPartyPortal/Global.asax.cs
@@ -8,11 +8,6 @@ namespace ConsumerPortal {
public class Global : System.Web.HttpApplication {
internal static StringBuilder LogMessages = new StringBuilder();
- public Global() {
- // since this is a sample, and will often be used with localhost
- DotNetOpenId.UntrustedWebRequest.WhitelistHosts.Add("localhost");
- }
-
public static log4net.ILog Logger = log4net.LogManager.GetLogger(typeof(Global));
protected void Application_Start(object sender, EventArgs e) {
diff --git a/samples/RelyingPartyPortal/RelyingPartyPortal.csproj b/samples/RelyingPartyPortal/RelyingPartyPortal.csproj
index 9799cac..24fd010 100644
--- a/samples/RelyingPartyPortal/RelyingPartyPortal.csproj
+++ b/samples/RelyingPartyPortal/RelyingPartyPortal.csproj
@@ -2,7 +2,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
+ <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{51BCD5E9-E17A-4FB2-BAC8-C156DD7A1CA4}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
@@ -54,6 +54,16 @@
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Code\CustomStore.cs" />
+ <Compile Include="Code\CustomStoreDataSet.cs">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="Code\CustomStoreDataSet.Designer.cs">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ </Compile>
<Compile Include="Code\State.cs" />
<Compile Include="Code\TracePageAppender.cs" />
<Compile Include="Global.asax.cs">
@@ -112,6 +122,19 @@
<Content Include="Site.Master" />
<Content Include="TracePage.aspx" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="Code\CustomStoreDataSet.xsc">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ </None>
+ <None Include="Code\CustomStoreDataSet.xsd">
+ <Generator>MSDataSetGenerator</Generator>
+ <LastGenOutput>CustomStoreDataSet.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </None>
+ <None Include="Code\CustomStoreDataSet.xss">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ </None>
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -132,6 +155,9 @@
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
+ <UseCustomServer>False</UseCustomServer>
+ <CustomServerUrl>
+ </CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
diff --git a/samples/RelyingPartyPortal/Web.config b/samples/RelyingPartyPortal/Web.config
index c7a8349..3c68b88 100644
--- a/samples/RelyingPartyPortal/Web.config
+++ b/samples/RelyingPartyPortal/Web.config
@@ -2,7 +2,25 @@
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" />
+ <sectionGroup name="dotNetOpenId">
+ <section name="relyingParty" type="DotNetOpenId.Configuration.RelyingPartySection" requirePermission="false" allowLocation="true"/>
+ <section name="provider" type="DotNetOpenId.Configuration.ProviderSection" requirePermission="false" allowLocation="true"/>
+ <section name="untrustedWebRequest" type="DotNetOpenId.Configuration.UntrustedWebRequestSection" requirePermission="false" allowLocation="false"/>
+ </sectionGroup>
</configSections>
+ <dotNetOpenId>
+ <relyingParty>
+ <security requireSsl="false" />
+ <!-- Uncomment the following to activate the sample custom store. -->
+ <!--<store type="ConsumerPortal.Code.CustomStore, ConsumerPortal" />-->
+ </relyingParty>
+ <untrustedWebRequest>
+ <whitelistHosts>
+ <!-- since this is a sample, and will often be used with localhost -->
+ <add name="localhost" />
+ </whitelistHosts>
+ </untrustedWebRequest>
+ </dotNetOpenId>
<system.web>
<!--<sessionState cookieless="true" />-->
<compilation debug="true"/>
@@ -46,4 +64,5 @@
<level value="ALL" />
</logger>
</log4net>
+
</configuration>
diff --git a/samples/RelyingPartyPortal/loginProgrammatic.aspx.cs b/samples/RelyingPartyPortal/loginProgrammatic.aspx.cs
index 1abd587..39a6f9b 100644
--- a/samples/RelyingPartyPortal/loginProgrammatic.aspx.cs
+++ b/samples/RelyingPartyPortal/loginProgrammatic.aspx.cs
@@ -1,4 +1,5 @@
using System;
+using System.Net;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
@@ -11,9 +12,28 @@ public partial class loginProgrammatic : System.Web.UI.Page {
args.IsValid = Identifier.IsValid(args.Value);
}
+ OpenIdRelyingParty createRelyingParty() {
+ OpenIdRelyingParty openid = new OpenIdRelyingParty();
+ int minsha, maxsha, minversion;
+ if (int.TryParse(Request.QueryString["minsha"], out minsha)) {
+ openid.Settings.MinimumHashBitLength = minsha;
+ }
+ if (int.TryParse(Request.QueryString["maxsha"], out maxsha)) {
+ openid.Settings.MaximumHashBitLength = maxsha;
+ }
+ if (int.TryParse(Request.QueryString["minversion"], out minversion)) {
+ switch (minversion) {
+ case 1: openid.Settings.MinimumRequiredOpenIdVersion = ProtocolVersion.V10; break;
+ case 2: openid.Settings.MinimumRequiredOpenIdVersion = ProtocolVersion.V20; break;
+ default: throw new ArgumentOutOfRangeException("minversion");
+ }
+ }
+ return openid;
+ }
+
protected void loginButton_Click(object sender, EventArgs e) {
if (!Page.IsValid) return; // don't login if custom validation failed.
- OpenIdRelyingParty openid = new OpenIdRelyingParty();
+ OpenIdRelyingParty openid = createRelyingParty();
try {
IAuthenticationRequest request = openid.CreateRequest(openIdBox.Text);
// This is where you would add any OpenID extensions you wanted
@@ -27,13 +47,28 @@ public partial class loginProgrammatic : System.Web.UI.Page {
// was not a valid OpenID endpoint.
openidValidator.Text = ex.Message;
openidValidator.IsValid = false;
+ } catch (WebException ex) {
+ // The user probably entered an Identifier that
+ // was not a valid OpenID endpoint.
+ openidValidator.Text = ex.Message;
+ openidValidator.IsValid = false;
}
}
protected void Page_Load(object sender, EventArgs e) {
openIdBox.Focus();
+ // For debugging/testing, we allow remote clearing of all associations...
+ // NOT a good idea on a production site.
+ if (Request.QueryString["clearAssociations"] == "1") {
+ Application.Remove("DotNetOpenId.RelyingParty.RelyingParty.AssociationStore");
+ // Force a redirect now to prevent the user from logging in while associations
+ // are constantly being cleared.
+ UriBuilder builder = new UriBuilder(Request.Url);
+ builder.Query = null;
+ Response.Redirect(builder.Uri.AbsoluteUri);
+ }
- OpenIdRelyingParty openid = new OpenIdRelyingParty();
+ OpenIdRelyingParty openid = createRelyingParty();
if (openid.Response != null) {
switch (openid.Response.Status) {
case AuthenticationStatus.Authenticated: