diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-03-01 22:02:39 +0000 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2008-03-01 22:02:39 +0000 |
commit | 150ff22dff828cabdf8d67a1457e64bb8ef99c30 (patch) | |
tree | 72cac907eb186f9314361dd08f3d4e9965b3691d | |
parent | 80f94bcf3710489f645d010c177c5e60b039c6fb (diff) | |
download | DotNetOpenAuth-150ff22dff828cabdf8d67a1457e64bb8ef99c30.zip DotNetOpenAuth-150ff22dff828cabdf8d67a1457e64bb8ef99c30.tar.gz DotNetOpenAuth-150ff22dff828cabdf8d67a1457e64bb8ef99c30.tar.bz2 |
Revised ASP.NET hosting plan and added a few more tests.
git-svn-id: https://dotnetopenid.googlecode.com/svn/trunk@259 01efa1a6-402a-0410-b0ae-47b76eba00f0
18 files changed, 276 insertions, 104 deletions
diff --git a/src/DotNetOpenId.Test/Consumer/OpenIdConsumerTest.cs b/src/DotNetOpenId.Test/Consumer/OpenIdConsumerTest.cs index e9e31e1..a80f8d6 100644 --- a/src/DotNetOpenId.Test/Consumer/OpenIdConsumerTest.cs +++ b/src/DotNetOpenId.Test/Consumer/OpenIdConsumerTest.cs @@ -15,7 +15,7 @@ namespace DotNetOpenId.Test.Consumer { [SetUp]
public void Setup() {
- store = new DotNetOpenId.Consumer.ConsumerApplicationMemoryStore();
+ store = new ConsumerApplicationMemoryStore();
}
[Test]
@@ -58,7 +58,7 @@ namespace DotNetOpenId.Test.Consumer { var consumer = new OpenIdConsumer(query, store);
Assert.IsNull(consumer.Response);
- var request = consumer.CreateRequest(simpleOpenId, simpleTrustRoot, simpleReturnTo);
+ var request = consumer.CreateRequest(TestSupport.IdentityUrl, simpleTrustRoot, simpleReturnTo);
// Test defaults
Assert.AreEqual(AuthenticationRequestMode.Setup, request.Mode);
diff --git a/src/DotNetOpenId.Test/Consumer/OpenIdTextBoxTest.cs b/src/DotNetOpenId.Test/Consumer/OpenIdTextBoxTest.cs new file mode 100644 index 0000000..0c70d78 --- /dev/null +++ b/src/DotNetOpenId.Test/Consumer/OpenIdTextBoxTest.cs @@ -0,0 +1,17 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using DotNetOpenId.Test.Hosting;
+using System.Net;
+
+namespace DotNetOpenId.Test.Consumer {
+ [TestFixture]
+ public class OpenIdTextBoxTest {
+ [Test]
+ public void TextBoxAppears() {
+ string html = TestSupport.HttpHost.ProcessRequest(TestSupport.ConsumerPage);
+ Assert.IsTrue(html.Contains("<input "));
+ }
+ }
+}
diff --git a/src/DotNetOpenId.Test/DiffieHellmanTestSuite.cs b/src/DotNetOpenId.Test/DiffieHellmanTestSuite.cs index 08de7b1..2ded2ab 100644 --- a/src/DotNetOpenId.Test/DiffieHellmanTestSuite.cs +++ b/src/DotNetOpenId.Test/DiffieHellmanTestSuite.cs @@ -36,7 +36,7 @@ namespace DotNetOpenId.Test Assert.AreNotEqual(s1, s2, "Secret keys should NOT be the same.");
}
- [Test]
+ [Test, Explicit("Test is slow.")]
public void TestPublic()
{
StreamReader sr = new StreamReader(@"..\..\src\DotNetOpenId.Test\dhpriv.txt");
diff --git a/src/DotNetOpenId.Test/DotNetOpenId.Test.csproj b/src/DotNetOpenId.Test/DotNetOpenId.Test.csproj index d605512..25d65a5 100644 --- a/src/DotNetOpenId.Test/DotNetOpenId.Test.csproj +++ b/src/DotNetOpenId.Test/DotNetOpenId.Test.csproj @@ -41,16 +41,19 @@ <Compile Include="AssociationsTest.cs" />
<Compile Include="AssociationTestSuite.cs" />
<Compile Include="Consumer\OpenIdConsumerTest.cs" />
+ <Compile Include="Consumer\OpenIdTextBoxTest.cs" />
<Compile Include="DictionarySerializerTestSuite.cs" />
<Compile Include="DiffieHellmanTestSuite.cs" />
- <Compile Include="Hosting.Tests\AspNetHostTest.cs" />
- <Compile Include="Hosting.Tests\HttpHostTest.cs" />
+ <Compile Include="TestSupportSanityTest.cs" />
<Compile Include="Hosting\AspNetHost.cs" />
<Compile Include="Hosting\HttpHost.cs" />
+ <Compile Include="TestSupport.cs" />
<Compile Include="Hosting\TestingWorkerRequest.cs" />
<Compile Include="ProfileFieldValuesTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Provider\IdentityEndpointTest.cs" />
<Compile Include="Provider\OpenIdProviderTest.cs" />
+ <Compile Include="Provider\ProviderEndpointTest.cs" />
<Compile Include="TrustRootTestSuite.cs" />
<Compile Include="UriUtilTest.cs" />
</ItemGroup>
@@ -63,6 +66,9 @@ <Name>DotNetOpenId</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="Hosting.Tests\" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.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.
diff --git a/src/DotNetOpenId.Test/Hosting.Tests/AspNetHostTest.cs b/src/DotNetOpenId.Test/Hosting.Tests/AspNetHostTest.cs deleted file mode 100644 index f36d042..0000000 --- a/src/DotNetOpenId.Test/Hosting.Tests/AspNetHostTest.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System;
-using System.Collections.Generic;
-using System.Text;
-using NUnit.Framework;
-using System.IO;
-using System.Diagnostics;
-using DotNetOpenId.Test.Hosting;
-using System.Text.RegularExpressions;
-
-namespace DotNetOpenId.Test.Hosting.Tests {
- [TestFixture]
- public class AspNetHostTest {
- public static readonly string TestWebDirectory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\src\DotNetOpenId.TestWeb"));
- public const string HostTestPage = "HostTest.aspx";
- AspNetHost host;
-
- [SetUp]
- public void SetUpHost() {
- host = AspNetHost.CreateHost(TestWebDirectory);
- }
-
- [Test]
- public void TestHost() {
- StringWriter sw = new StringWriter();
- string query = "a=b&c=d";
- string body = "aa=bb&cc=dd";
- Stream bodyStream = new MemoryStream(Encoding.ASCII.GetBytes(body));
- host.ProcessRequest(HostTestPage,query, bodyStream, sw);
- string resultHtml = sw.ToString();
- Assert.IsFalse(string.IsNullOrEmpty(resultHtml));
- Debug.WriteLine(resultHtml);
- Assert.IsTrue(Regex.IsMatch(resultHtml, @"Query.*" + Regex.Escape(query)));
- Assert.IsTrue(Regex.IsMatch(resultHtml, @"Body.*" + Regex.Escape(body)));
- }
- }
-}
diff --git a/src/DotNetOpenId.Test/Hosting.Tests/HttpHostTest.cs b/src/DotNetOpenId.Test/Hosting.Tests/HttpHostTest.cs deleted file mode 100644 index 3b8bee6..0000000 --- a/src/DotNetOpenId.Test/Hosting.Tests/HttpHostTest.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System;
-using System.Collections.Generic;
-using System.Text;
-using NUnit.Framework;
-using System.Net;
-using System.Globalization;
-using System.IO;
-using System.Diagnostics;
-using System.Text.RegularExpressions;
-
-namespace DotNetOpenId.Test.Hosting.Tests {
- [TestFixture]
- public class HttpHostTest {
- HttpHost host;
- [SetUp]
- public void HostSetUp() {
- host = new HttpHost(AspNetHostTest.TestWebDirectory);
- }
-
- [TearDown]
- public void HostTearDown() {
- host.Dispose();
- }
-
- [Test]
- public void TestHost() {
- string query = "a=b&c=d";
- string body = "aa=bb&cc=dd";
-
- WebRequest request = WebRequest.Create(string.Format(CultureInfo.InvariantCulture,
- "http://localhost:{0}/{1}?{2}", host.Port, AspNetHostTest.HostTestPage, query));
- request.Method = "POST";
- request.ContentLength = body.Length;
- using (StreamWriter sw = new StreamWriter(request.GetRequestStream()))
- sw.Write(body);
-
- WebResponse response = request.GetResponse();
- string resultHtml;
- using (StreamReader sr = new StreamReader(response.GetResponseStream()))
- resultHtml = sr.ReadToEnd();
- Assert.IsFalse(string.IsNullOrEmpty(resultHtml));
- Debug.WriteLine(resultHtml);
- Assert.IsTrue(Regex.IsMatch(resultHtml, @"Query.*" + Regex.Escape(query)));
- Assert.IsTrue(Regex.IsMatch(resultHtml, @"Body.*" + Regex.Escape(body)));
- }
-
- }
-}
diff --git a/src/DotNetOpenId.Test/Hosting/AspNetHost.cs b/src/DotNetOpenId.Test/Hosting/AspNetHost.cs index 5785016..86ce4cd 100644 --- a/src/DotNetOpenId.Test/Hosting/AspNetHost.cs +++ b/src/DotNetOpenId.Test/Hosting/AspNetHost.cs @@ -4,6 +4,7 @@ using System.Text; using System.Web;
using System.Web.Hosting;
using System.IO;
+using System.Diagnostics;
namespace DotNetOpenId.Test.Hosting {
/// <summary>
@@ -12,13 +13,32 @@ namespace DotNetOpenId.Test.Hosting { /// </summary>
class AspNetHost : MarshalByRefObject {
public static AspNetHost CreateHost(string webDirectory) {
- AspNetHost host = (AspNetHost)System.Web.Hosting.ApplicationHost.
+ AspNetHost host = (AspNetHost)ApplicationHost.
CreateApplicationHost(typeof(AspNetHost), "/", webDirectory);
return host;
}
- public void ProcessRequest(string page, string query, Stream body, TextWriter responseWriter) {
- ProcessRequest(new TestingWorkerRequest(page, query, body, responseWriter));
+ public string ProcessRequest(string page) {
+ return ProcessRequest(page, string.Empty);
+ }
+
+ public string ProcessRequest(string page, string query) {
+ return ProcessRequest(page, query, null);
+ }
+
+ public string ProcessRequest(string page, string query, string body) {
+ Trace.TraceInformation("Submitting ASP.NET request: {0}?{1}{2}{3}",
+ page, query, Environment.NewLine, body);
+ using (TextWriter tw = new StringWriter()) {
+ Stream bodyStream = body != null ? new MemoryStream(Encoding.ASCII.GetBytes(body)) : null;
+ ProcessRequest(page, query, bodyStream, tw);
+ Trace.TraceInformation("Response:{0}{1}", Environment.NewLine, tw);
+ return tw.ToString();
+ }
+ }
+
+ public void ProcessRequest(string page, string query, Stream body, TextWriter response) {
+ ProcessRequest(new TestingWorkerRequest(page, query, body, response));
}
public void ProcessRequest(HttpWorkerRequest wr) {
diff --git a/src/DotNetOpenId.Test/Hosting/HttpHost.cs b/src/DotNetOpenId.Test/Hosting/HttpHost.cs index 8dd45f4..f7e0082 100644 --- a/src/DotNetOpenId.Test/Hosting/HttpHost.cs +++ b/src/DotNetOpenId.Test/Hosting/HttpHost.cs @@ -13,18 +13,31 @@ namespace DotNetOpenId.Test.Hosting { Thread listenerThread;
AspNetHost aspNetHost;
- public HttpHost(string webDirectory) {
+ HttpHost(string webDirectory) {
aspNetHost = AspNetHost.CreateHost(webDirectory);
- listener = new HttpListener();
Port = 59687;
- listener.Prefixes.Add(string.Format(CultureInfo.InvariantCulture,
- "http://localhost:{0}/", Port));
- listener.Start();
+ Random r = new Random();
+ tryAgain:
+ try {
+ listener = new HttpListener();
+ listener.Prefixes.Add(string.Format(CultureInfo.InvariantCulture,
+ "http://localhost:{0}/", Port));
+ listener.Start();
+ } catch (HttpListenerException ex) {
+ if (ex.Message.Contains("conflicts")) {
+ Port += r.Next(1, 20);
+ goto tryAgain;
+ }
+ throw;
+ }
listenerThread = new Thread(processRequests);
listenerThread.Start();
}
+ public static HttpHost CreateHost(string webDirectory) {
+ return new HttpHost(webDirectory);
+ }
void processRequests() {
try {
while (true) {
@@ -42,6 +55,26 @@ namespace DotNetOpenId.Test.Hosting { }
}
+ public Uri BaseUri {
+ get { return new Uri("http://localhost:" + Port.ToString() + "/"); }
+ }
+ public string ProcessRequest(string url) {
+ return ProcessRequest(url, null);
+ }
+ public string ProcessRequest(string url, string body) {
+ WebRequest request = WebRequest.Create(new Uri(BaseUri, url));
+ if (body != null) {
+ request.Method = "POST";
+ request.ContentLength = body.Length;
+ using (StreamWriter sw = new StreamWriter(request.GetRequestStream()))
+ sw.Write(body);
+ }
+ using (WebResponse response = request.GetResponse()) {
+ using (StreamReader sr = new StreamReader(response.GetResponseStream()))
+ return sr.ReadToEnd();
+ }
+ }
+
#region IDisposable Members
public void Dispose() {
diff --git a/src/DotNetOpenId.Test/Provider/IdentityEndpointTest.cs b/src/DotNetOpenId.Test/Provider/IdentityEndpointTest.cs new file mode 100644 index 0000000..61aac8d --- /dev/null +++ b/src/DotNetOpenId.Test/Provider/IdentityEndpointTest.cs @@ -0,0 +1,27 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.IO;
+using System.Diagnostics;
+using DotNetOpenId.Test.Hosting;
+using System.Text.RegularExpressions;
+using System.Net;
+using System.Globalization;
+
+namespace DotNetOpenId.Test.Provider {
+ [TestFixture]
+ public class IdentityEndpointTest {
+ [Test]
+ public void IdentityEndpointPage() {
+ string html = TestSupport.HttpHost.ProcessRequest(TestSupport.IdentityPage);
+ Trace.TraceInformation("{0} response:{1}{2}", TestSupport.IdentityPage, Environment.NewLine, html);
+ Assert.IsTrue(Regex.IsMatch(html, string.Format(CultureInfo.InvariantCulture,
+ @"\<link rel=""openid.server"" href=""http://[^/]+/{0}""\>\</link\>",
+ TestSupport.ProviderPage)));
+ Assert.IsTrue(Regex.IsMatch(html, string.Format(CultureInfo.InvariantCulture,
+ @"\<link rel=""openid.delegate"" href=""http://[^/]+{0}""\>\</link\>",
+ Regex.Escape(TestSupport.IdentityUrl.AbsolutePath))));
+ }
+ }
+}
diff --git a/src/DotNetOpenId.Test/Provider/OpenIdProviderTest.cs b/src/DotNetOpenId.Test/Provider/OpenIdProviderTest.cs index 95d8cff..b5ca691 100644 --- a/src/DotNetOpenId.Test/Provider/OpenIdProviderTest.cs +++ b/src/DotNetOpenId.Test/Provider/OpenIdProviderTest.cs @@ -6,17 +6,10 @@ using System.IO; using System.Diagnostics;
using DotNetOpenId.Test.Hosting;
using System.Text.RegularExpressions;
-using DotNetOpenId.Test.Hosting.Tests;
namespace DotNetOpenId.Test.Provider {
[TestFixture]
public class OpenIdProviderTest {
- AspNetHost host;
-
- [SetUp]
- public void SetUpHost() {
- host = AspNetHost.CreateHost(AspNetHostTest.TestWebDirectory);
- }
}
}
diff --git a/src/DotNetOpenId.Test/Provider/ProviderEndpointTest.cs b/src/DotNetOpenId.Test/Provider/ProviderEndpointTest.cs new file mode 100644 index 0000000..f39ad7e --- /dev/null +++ b/src/DotNetOpenId.Test/Provider/ProviderEndpointTest.cs @@ -0,0 +1,11 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using DotNetOpenId.Test.Hosting;
+
+namespace DotNetOpenId.Test.Provider {
+ [TestFixture]
+ public class ProviderEndpointTest {
+ }
+}
diff --git a/src/DotNetOpenId.Test/TestSupport.cs b/src/DotNetOpenId.Test/TestSupport.cs new file mode 100644 index 0000000..f65d353 --- /dev/null +++ b/src/DotNetOpenId.Test/TestSupport.cs @@ -0,0 +1,34 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.IO;
+using System.Globalization;
+using DotNetOpenId.Test.Hosting;
+
+[SetUpFixture]
+public class TestSupport {
+ public static readonly string TestWebDirectory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\src\DotNetOpenId.TestWeb"));
+ public const string HostTestPage = "HostTest.aspx";
+ public const string IdentityPage = "IdentityEndpoint.aspx";
+ public const string ProviderPage = "ProviderEndpoint.aspx";
+ public const string ConsumerPage = "Consumer.aspx";
+ public static Uri IdentityUrl {
+ get {
+ return new Uri(HttpHost.BaseUri, "/bob");
+ }
+ }
+
+ internal static HttpHost HttpHost { get; private set; }
+
+ [SetUp]
+ public void SetUp() {
+ HttpHost = HttpHost.CreateHost(TestSupport.TestWebDirectory);
+ }
+
+ [TearDown]
+ public void TearDown() {
+ HttpHost.Dispose();
+ HttpHost = null;
+ }
+}
diff --git a/src/DotNetOpenId.Test/TestSupportSanityTest.cs b/src/DotNetOpenId.Test/TestSupportSanityTest.cs new file mode 100644 index 0000000..074cfd0 --- /dev/null +++ b/src/DotNetOpenId.Test/TestSupportSanityTest.cs @@ -0,0 +1,27 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Net;
+using System.Globalization;
+using System.IO;
+using System.Diagnostics;
+using System.Text.RegularExpressions;
+
+namespace DotNetOpenId.Test {
+ [TestFixture]
+ public class TestSupportSanityTest {
+ [Test]
+ public void TestHost() {
+ string query = "a=b&c=d";
+ string body = "aa=bb&cc=dd";
+ string resultHtml = TestSupport.HttpHost.ProcessRequest(TestSupport.HostTestPage + "?" + query, body);
+
+ Assert.IsFalse(string.IsNullOrEmpty(resultHtml));
+ Debug.WriteLine(resultHtml);
+ Assert.IsTrue(Regex.IsMatch(resultHtml, @"Query.*" + Regex.Escape(query)));
+ Assert.IsTrue(Regex.IsMatch(resultHtml, @"Body.*" + Regex.Escape(body)));
+ }
+
+ }
+}
diff --git a/src/DotNetOpenId.TestWeb/Consumer.aspx b/src/DotNetOpenId.TestWeb/Consumer.aspx new file mode 100644 index 0000000..30597a8 --- /dev/null +++ b/src/DotNetOpenId.TestWeb/Consumer.aspx @@ -0,0 +1,15 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Consumer.aspx.cs" Inherits="Consumer" %>
+
+<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId.Consumer" 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">
+ <title>Untitled Page</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <openid:OpenIdTextBox ID="OpenIdTextBox1" runat="server" />
+ </form>
+</body>
+</html>
diff --git a/src/DotNetOpenId.TestWeb/Consumer.aspx.cs b/src/DotNetOpenId.TestWeb/Consumer.aspx.cs new file mode 100644 index 0000000..4c8b582 --- /dev/null +++ b/src/DotNetOpenId.TestWeb/Consumer.aspx.cs @@ -0,0 +1,16 @@ +using System;
+using System.Collections;
+using System.Configuration;
+using System.Data;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+
+public partial class Consumer : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+
+ }
+}
diff --git a/src/DotNetOpenId.TestWeb/IdentityEndpoint.aspx b/src/DotNetOpenId.TestWeb/IdentityEndpoint.aspx new file mode 100644 index 0000000..d6eb54f --- /dev/null +++ b/src/DotNetOpenId.TestWeb/IdentityEndpoint.aspx @@ -0,0 +1,21 @@ +<%@ Page Language="C#" %>
+
+<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId.Provider" TagPrefix="openid" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<script runat="server">
+
+</script>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title>Identity page</title>
+ <openid:IdentityEndpoint ID="IdentityEndpoint1" runat="server"
+ ServerUrl="~/ProviderEndpoint.aspx" DelegateUrl="~/bob"/>
+</head>
+<body>
+ <form id="form1" runat="server">
+ </form>
+</body>
+</html>
diff --git a/src/DotNetOpenId.TestWeb/ProviderEndpoint.aspx b/src/DotNetOpenId.TestWeb/ProviderEndpoint.aspx new file mode 100644 index 0000000..f24bb1a --- /dev/null +++ b/src/DotNetOpenId.TestWeb/ProviderEndpoint.aspx @@ -0,0 +1,15 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ProviderEndpoint.aspx.cs"
+ Inherits="ProviderEndpoint" %>
+
+<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId.Provider" 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">
+ <title>Provider Endpoint Page</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <openid:ProviderEndpoint ID="ProviderEndpoint1" runat='server' OnAuthenticationChallenge="ProviderEndpoint1_AuthenticationChallenge" />
+ </form>
+</body>
+</html>
diff --git a/src/DotNetOpenId.TestWeb/ProviderEndpoint.aspx.cs b/src/DotNetOpenId.TestWeb/ProviderEndpoint.aspx.cs new file mode 100644 index 0000000..8cf3614 --- /dev/null +++ b/src/DotNetOpenId.TestWeb/ProviderEndpoint.aspx.cs @@ -0,0 +1,21 @@ +using System;
+using System.Collections;
+using System.Configuration;
+using System.Data;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+
+public partial class ProviderEndpoint : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+
+ }
+ protected void ProviderEndpoint1_AuthenticationChallenge(object sender, DotNetOpenId.Provider.ProviderEndpoint.AuthenticationChallengeEventArgs e) {
+ // immediately approve
+ e.Request.IsAuthenticated = e.Request.IdentityUrl.AbsolutePath == "/bob";
+ e.Request.Response.Send();
+ }
+}
|