internal static MockHttpRequest CreateUntrustedMockHttpHandler() { TestWebRequestHandler testHandler = new TestWebRequestHandler(); UntrustedWebRequestHandler untrustedHandler = new UntrustedWebRequestHandler(testHandler); if (!untrustedHandler.WhitelistHosts.Contains("localhost")) { untrustedHandler.WhitelistHosts.Add("localhost"); } untrustedHandler.WhitelistHosts.Add(OpenIdTestBase.OPUri.Host); MockHttpRequest mock = new MockHttpRequest(untrustedHandler); testHandler.Callback = mock.GetMockResponse; return mock; }
public override void SetUp() { base.SetUp(); this.RelyingPartySecuritySettings = DotNetOpenAuthSection.Configuration.OpenId.RelyingParty.SecuritySettings.CreateSecuritySettings(); this.ProviderSecuritySettings = DotNetOpenAuthSection.Configuration.OpenId.Provider.SecuritySettings.CreateSecuritySettings(); this.MockResponder = MockHttpRequest.CreateUntrustedMockHttpHandler(); this.RequestHandler = this.MockResponder.MockWebRequestHandler; this.AutoProviderScenario = Scenarios.AutoApproval; Identifier.EqualityOnStrings = true; }
public MockIdentifier(Identifier wrappedIdentifier, MockHttpRequest mockHttpRequest, IEnumerable<IdentifierDiscoveryResult> endpoints) : base(wrappedIdentifier.OriginalString, false) { Requires.NotNull(wrappedIdentifier, "wrappedIdentifier"); Requires.NotNull(mockHttpRequest, "mockHttpRequest"); Requires.NotNull(endpoints, "endpoints"); this.wrappedIdentifier = wrappedIdentifier; this.endpoints = endpoints; this.mockHttpRequest = mockHttpRequest; // Register a mock HTTP response to enable discovery of this identifier within the RP // without having to host an ASP.NET site within the test. mockHttpRequest.RegisterMockXrdsResponse(new Uri(wrappedIdentifier.ToString()), endpoints); }
public MockIdentifier(Identifier wrappedIdentifier, MockHttpRequest mockHttpRequest, IEnumerable<IdentifierDiscoveryResult> endpoints) : base(wrappedIdentifier.OriginalString, false) { Contract.Requires<ArgumentNullException>(wrappedIdentifier != null); Contract.Requires<ArgumentNullException>(mockHttpRequest != null); Contract.Requires<ArgumentNullException>(endpoints != null); this.wrappedIdentifier = wrappedIdentifier; this.endpoints = endpoints; this.mockHttpRequest = mockHttpRequest; // Register a mock HTTP response to enable discovery of this identifier within the RP // without having to host an ASP.NET site within the test. mockHttpRequest.RegisterMockXrdsResponse(new Uri(wrappedIdentifier.ToString()), endpoints); }
public MockIdentifier(Identifier wrappedIdentifier, MockHttpRequest mockHttpRequest, IEnumerable <IdentifierDiscoveryResult> endpoints) : base(wrappedIdentifier.OriginalString, false) { Requires.NotNull(wrappedIdentifier, "wrappedIdentifier"); Requires.NotNull(mockHttpRequest, "mockHttpRequest"); Requires.NotNull(endpoints, "endpoints"); this.wrappedIdentifier = wrappedIdentifier; this.endpoints = endpoints; this.mockHttpRequest = mockHttpRequest; // Register a mock HTTP response to enable discovery of this identifier within the RP // without having to host an ASP.NET site within the test. mockHttpRequest.RegisterMockXrdsResponse(new Uri(wrappedIdentifier.ToString()), endpoints); }
public MockIdentifier(Identifier wrappedIdentifier, MockHttpRequest mockHttpRequest, IEnumerable <IdentifierDiscoveryResult> endpoints) : base(wrappedIdentifier.OriginalString, false) { Contract.Requires <ArgumentNullException>(wrappedIdentifier != null); Contract.Requires <ArgumentNullException>(mockHttpRequest != null); Contract.Requires <ArgumentNullException>(endpoints != null); this.wrappedIdentifier = wrappedIdentifier; this.endpoints = endpoints; this.mockHttpRequest = mockHttpRequest; // Register a mock HTTP response to enable discovery of this identifier within the RP // without having to host an ASP.NET site within the test. mockHttpRequest.RegisterMockXrdsResponse(new Uri(wrappedIdentifier.ToString()), endpoints); }
internal static MockHttpRequest CreateUntrustedMockHttpHandler() { TestWebRequestHandler testHandler = new TestWebRequestHandler(); UntrustedWebRequestHandler untrustedHandler = new UntrustedWebRequestHandler(testHandler); if (!untrustedHandler.WhitelistHosts.Contains("localhost")) { untrustedHandler.WhitelistHosts.Add("localhost"); } untrustedHandler.WhitelistHosts.Add(OpenIdTestBase.OPUri.Host); MockHttpRequest mock = new MockHttpRequest(untrustedHandler); testHandler.Callback = mock.GetMockResponse; return(mock); }
public MockIdentifier(Identifier wrappedIdentifier, MockHttpRequest mockHttpRequest, IEnumerable<ServiceEndpoint> endpoints) : base(false) { ErrorUtilities.VerifyArgumentNotNull(wrappedIdentifier, "wrappedIdentifier"); ErrorUtilities.VerifyArgumentNotNull(mockHttpRequest, "mockHttpRequest"); ErrorUtilities.VerifyArgumentNotNull(endpoints, "endpoints"); this.wrappedIdentifier = wrappedIdentifier; this.endpoints = endpoints; this.mockHttpRequest = mockHttpRequest; // Register a mock HTTP response to enable discovery of this identifier within the RP // without having to host an ASP.NET site within the test. mockHttpRequest.RegisterMockXrdsResponse(new Uri(wrappedIdentifier.ToString()), endpoints); }