diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-01-09 21:03:29 -0800 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2009-01-09 21:03:29 -0800 |
commit | d8abcbe507383d3510ee45ed19f6503c60d7d63b (patch) | |
tree | 64d656b165aed099ef68881c98082d552f5af2e4 /src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs | |
parent | 588d1384431e23827921124bd438569231cbdfa7 (diff) | |
download | DotNetOpenAuth-d8abcbe507383d3510ee45ed19f6503c60d7d63b.zip DotNetOpenAuth-d8abcbe507383d3510ee45ed19f6503c60d7d63b.tar.gz DotNetOpenAuth-d8abcbe507383d3510ee45ed19f6503c60d7d63b.tar.bz2 |
CRLF -> LF line endings change to all .cs files.
Diffstat (limited to 'src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs')
-rw-r--r-- | src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs index 7a194b7..048deba 100644 --- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs @@ -1,60 +1,60 @@ -//-----------------------------------------------------------------------
-// <copyright file="PositiveAuthenticationResponseTests.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
- using System;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OpenId;
- using DotNetOpenAuth.OpenId.Messages;
- using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
-
- [TestClass]
- public class PositiveAuthenticationResponseTests : OpenIdTestBase {
- private readonly Realm realm = new Realm(TestSupport.GetFullUrl(TestSupport.ConsumerPage).AbsoluteUri);
- private readonly Uri returnTo = TestSupport.GetFullUrl(TestSupport.ConsumerPage);
-
- [TestInitialize]
- public override void SetUp() {
- base.SetUp();
- }
-
- /// <summary>
- /// Verifies good, positive assertions are accepted.
- /// </summary>
- [TestMethod]
- public void Valid() {
- PositiveAssertionResponse assertion = this.GetPositiveAssertion();
- var rp = CreateRelyingParty();
- var authResponse = new PositiveAuthenticationResponse(assertion, rp);
- Assert.AreEqual(AuthenticationStatus.Authenticated, authResponse.Status);
- }
-
- /// <summary>
- /// Verifies that the RP rejects signed solicited assertions by an OP that
- /// makes up a claimed Id that was not part of the original request, and
- /// that the OP has no authority to assert positively regarding.
- /// </summary>
- [TestMethod, ExpectedException(typeof(ProtocolException))]
- public void SpoofedClaimedIdDetectionSolicited() {
- PositiveAssertionResponse assertion = this.GetPositiveAssertion();
- assertion.ProviderEndpoint = new Uri("http://rogueOP");
- var rp = CreateRelyingParty();
- var authResponse = new PositiveAuthenticationResponse(assertion, rp);
- Assert.AreEqual(AuthenticationStatus.Failed, authResponse.Status);
- }
-
- private PositiveAssertionResponse GetPositiveAssertion() {
- Protocol protocol = Protocol.Default;
- PositiveAssertionResponse assertion = new PositiveAssertionResponse(protocol.Version, this.returnTo);
- assertion.ClaimedIdentifier = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.MockResponder, protocol.ProtocolVersion);
- assertion.LocalIdentifier = TestSupport.GetDelegateUrl(TestSupport.Scenarios.AutoApproval);
- assertion.ReturnTo = this.returnTo;
- assertion.ProviderEndpoint = TestSupport.GetFullUrl("/" + TestSupport.ProviderPage, null, false);
- return assertion;
- }
- }
-}
+//----------------------------------------------------------------------- +// <copyright file="PositiveAuthenticationResponseTests.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.Test.OpenId.RelyingParty { + using System; + using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId; + using DotNetOpenAuth.OpenId.Messages; + using DotNetOpenAuth.OpenId.RelyingParty; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class PositiveAuthenticationResponseTests : OpenIdTestBase { + private readonly Realm realm = new Realm(TestSupport.GetFullUrl(TestSupport.ConsumerPage).AbsoluteUri); + private readonly Uri returnTo = TestSupport.GetFullUrl(TestSupport.ConsumerPage); + + [TestInitialize] + public override void SetUp() { + base.SetUp(); + } + + /// <summary> + /// Verifies good, positive assertions are accepted. + /// </summary> + [TestMethod] + public void Valid() { + PositiveAssertionResponse assertion = this.GetPositiveAssertion(); + var rp = CreateRelyingParty(); + var authResponse = new PositiveAuthenticationResponse(assertion, rp); + Assert.AreEqual(AuthenticationStatus.Authenticated, authResponse.Status); + } + + /// <summary> + /// Verifies that the RP rejects signed solicited assertions by an OP that + /// makes up a claimed Id that was not part of the original request, and + /// that the OP has no authority to assert positively regarding. + /// </summary> + [TestMethod, ExpectedException(typeof(ProtocolException))] + public void SpoofedClaimedIdDetectionSolicited() { + PositiveAssertionResponse assertion = this.GetPositiveAssertion(); + assertion.ProviderEndpoint = new Uri("http://rogueOP"); + var rp = CreateRelyingParty(); + var authResponse = new PositiveAuthenticationResponse(assertion, rp); + Assert.AreEqual(AuthenticationStatus.Failed, authResponse.Status); + } + + private PositiveAssertionResponse GetPositiveAssertion() { + Protocol protocol = Protocol.Default; + PositiveAssertionResponse assertion = new PositiveAssertionResponse(protocol.Version, this.returnTo); + assertion.ClaimedIdentifier = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.MockResponder, protocol.ProtocolVersion); + assertion.LocalIdentifier = TestSupport.GetDelegateUrl(TestSupport.Scenarios.AutoApproval); + assertion.ReturnTo = this.returnTo; + assertion.ProviderEndpoint = TestSupport.GetFullUrl("/" + TestSupport.ProviderPage, null, false); + return assertion; + } + } +} |