summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenId.Test/EndToEndTesting.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenId.Test/EndToEndTesting.cs')
-rw-r--r--src/DotNetOpenId.Test/EndToEndTesting.cs47
1 files changed, 44 insertions, 3 deletions
diff --git a/src/DotNetOpenId.Test/EndToEndTesting.cs b/src/DotNetOpenId.Test/EndToEndTesting.cs
index 8f94744..1997638 100644
--- a/src/DotNetOpenId.Test/EndToEndTesting.cs
+++ b/src/DotNetOpenId.Test/EndToEndTesting.cs
@@ -25,10 +25,16 @@ namespace DotNetOpenId.Test {
void parameterizedTest(UriIdentifier identityUrl,
AuthenticationRequestMode requestMode, AuthenticationStatus expectedResult,
bool tryReplayAttack, bool provideStore) {
- parameterizedProgrammaticTest(identityUrl, requestMode, expectedResult, tryReplayAttack, provideStore);
+ parameterizedProgrammaticTest(identityUrl, identityUrl, requestMode, expectedResult, tryReplayAttack, provideStore);
parameterizedWebClientTest(identityUrl, requestMode, expectedResult, tryReplayAttack, provideStore);
}
- void parameterizedProgrammaticTest(UriIdentifier identityUrl,
+ void parameterizedTest(UriIdentifier opIdentifier, UriIdentifier claimedIdentifier,
+ AuthenticationRequestMode requestMode, AuthenticationStatus expectedResult,
+ bool tryReplayAttack, bool provideStore) {
+ parameterizedProgrammaticTest(opIdentifier, claimedIdentifier, requestMode, expectedResult, tryReplayAttack, provideStore);
+ parameterizedWebClientTest(opIdentifier, requestMode, expectedResult, tryReplayAttack, provideStore);
+ }
+ void parameterizedProgrammaticTest(UriIdentifier identityUrl, UriIdentifier claimedUrl,
AuthenticationRequestMode requestMode, AuthenticationStatus expectedResult,
bool tryReplayAttack, bool provideStore) {
var store = provideStore ? appStore : null;
@@ -74,7 +80,7 @@ namespace DotNetOpenId.Test {
}
consumer = new OpenIdRelyingParty(store, redirectUrl, HttpUtility.ParseQueryString(redirectUrl.Query));
Assert.AreEqual(expectedResult, consumer.Response.Status);
- Assert.AreEqual(identityUrl, consumer.Response.ClaimedIdentifier);
+ Assert.AreEqual(claimedUrl, consumer.Response.ClaimedIdentifier);
// Try replay attack
if (tryReplayAttack) {
@@ -268,5 +274,40 @@ namespace DotNetOpenId.Test {
false
);
}
+ [Test]
+ public void Pass_Setup_ApproveOnSetup_DirectedIdentity_20() {
+ parameterizedTest(
+ TestSupport.GetOPIdentityUrl(TestSupport.Scenarios.ApproveOnSetup),
+ TestSupport.GetDirectedIdentityUrl(TestSupport.Scenarios.ApproveOnSetup, ProtocolVersion.V20),
+ AuthenticationRequestMode.Setup,
+ AuthenticationStatus.Authenticated,
+ true,
+ true);
+ }
+ [Test]
+ public void Pass_NoStore_ApproveOnSetup_DirectedIdentity_20() {
+ parameterizedTest(
+ TestSupport.GetOPIdentityUrl(TestSupport.Scenarios.ApproveOnSetup),
+ TestSupport.GetDirectedIdentityUrl(TestSupport.Scenarios.ApproveOnSetup, ProtocolVersion.V20),
+ AuthenticationRequestMode.Setup,
+ AuthenticationStatus.Authenticated,
+ true,
+ false);
+ }
+
+ [Test]
+ public void ProviderAddedFragmentRemainsInClaimedIdentifier() {
+ Uri userSuppliedIdentifier = TestSupport.GetIdentityUrl(TestSupport.Scenarios.AutoApprovalAddFragment, ProtocolVersion.V20);
+ UriBuilder claimedIdentifier = new UriBuilder(userSuppliedIdentifier);
+ claimedIdentifier.Fragment = "frag";
+ parameterizedProgrammaticTest(
+ userSuppliedIdentifier,
+ claimedIdentifier.Uri,
+ AuthenticationRequestMode.Setup,
+ AuthenticationStatus.Authenticated,
+ false,
+ true
+ );
+ }
}
}