public void GetCallbackArguments() { PositiveAssertionResponse assertion = this.GetPositiveAssertion(); var rp = CreateRelyingParty(); UriBuilder returnToBuilder = new UriBuilder(assertion.ReturnTo); returnToBuilder.AppendQueryArgs(new Dictionary<string, string> { { "a", "b" } }); assertion.ReturnTo = returnToBuilder.Uri; var authResponse = new PositiveAuthenticationResponse(assertion, rp); // First pretend that the return_to args were signed. assertion.ReturnToParametersSignatureValidated = true; Assert.AreEqual(1, authResponse.GetCallbackArguments().Count); Assert.IsTrue(authResponse.GetCallbackArguments().ContainsKey("a")); Assert.AreEqual("b", authResponse.GetCallbackArgument("a")); // Now simulate them NOT being signed. assertion.ReturnToParametersSignatureValidated = false; Assert.AreEqual(0, authResponse.GetCallbackArguments().Count); Assert.IsFalse(authResponse.GetCallbackArguments().ContainsKey("a")); Assert.IsNull(authResponse.GetCallbackArgument("a")); }
public void Valid() { PositiveAssertionResponse assertion = this.GetPositiveAssertion(); ClaimsResponse extension = new ClaimsResponse(); assertion.Extensions.Add(extension); var rp = CreateRelyingParty(); var authResponse = new PositiveAuthenticationResponse(assertion, rp); Assert.AreEqual(AuthenticationStatus.Authenticated, authResponse.Status); Assert.IsNull(authResponse.Exception); Assert.AreEqual((string)assertion.ClaimedIdentifier, (string)authResponse.ClaimedIdentifier); Assert.AreEqual(authResponse.Endpoint.FriendlyIdentifierForDisplay, authResponse.FriendlyIdentifierForDisplay); Assert.AreSame(extension, authResponse.GetUntrustedExtension(typeof(ClaimsResponse))); Assert.AreSame(extension, authResponse.GetUntrustedExtension<ClaimsResponse>()); Assert.IsNull(authResponse.GetCallbackArgument("a")); Assert.AreEqual(0, authResponse.GetCallbackArguments().Count); }