blob: 04f58737d9a980603f03c811b6d2a8957bc713c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using DotNetOpenId.RelyingParty;
using DotNetOpenId.Extensions.SimpleRegistration;
using DotNetOpenId.Extensions.AttributeExchange;
namespace DotNetOpenId.Test.RelyingParty {
[TestFixture]
public class IProviderEndpointTests {
IRelyingPartyApplicationStore store;
Realm realm = new Realm(TestSupport.GetFullUrl(TestSupport.ConsumerPage).AbsoluteUri);
Uri returnTo = TestSupport.GetFullUrl(TestSupport.ConsumerPage);
[SetUp]
public void SetUp() {
store = new ApplicationMemoryStore();
if (!UntrustedWebRequest.WhitelistHosts.Contains("localhost"))
UntrustedWebRequest.WhitelistHosts.Add("localhost");
}
[Test]
public void IsExtensionSupportedTest() {
OpenIdRelyingParty rp = new OpenIdRelyingParty(store, null, null);
Identifier id = TestSupport.GetFullUrl("xrdsdiscovery/xrds20.aspx");
IAuthenticationRequest request = rp.CreateRequest(id, realm, returnTo);
IProviderEndpoint provider = request.Provider;
Assert.IsTrue(provider.IsExtensionSupported<ClaimsRequest>());
Assert.IsTrue(provider.IsExtensionSupported(typeof(ClaimsRequest)));
Assert.IsFalse(provider.IsExtensionSupported<FetchRequest>());
Assert.IsFalse(provider.IsExtensionSupported(typeof(FetchRequest)));
// Test the AdditionalTypeUris list by pulling from an XRDS page with one of the
// TypeURIs that only shows up in that list.
id = TestSupport.GetFullUrl("xrdsdiscovery/xrds10.aspx");
request = rp.CreateRequest(id, realm, returnTo);
Assert.IsTrue(provider.IsExtensionSupported<ClaimsRequest>());
Assert.IsTrue(provider.IsExtensionSupported(typeof(ClaimsRequest)));
}
[Test]
public void UriTest() {
OpenIdRelyingParty rp = new OpenIdRelyingParty(store, null, null);
Identifier id = TestSupport.GetFullUrl("xrdsdiscovery/xrds20.aspx");
IAuthenticationRequest request = rp.CreateRequest(id, realm, returnTo);
IProviderEndpoint provider = request.Provider;
Assert.AreEqual(new Uri("http://a/b"), provider.Uri);
}
}
}
|