//----------------------------------------------------------------------- // // Copyright (c) Andrew Arnott. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Test.Mocks { using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId; internal class MockRealm : Realm { private RelyingPartyEndpointDescription[] relyingPartyDescriptions; /// /// Initializes a new instance of the class. /// /// The wrapped realm. /// The relying party descriptions. internal MockRealm(Realm wrappedRealm, params RelyingPartyEndpointDescription[] relyingPartyDescriptions) : base(wrappedRealm) { Contract.Requires(relyingPartyDescriptions != null); this.relyingPartyDescriptions = relyingPartyDescriptions; } /// /// Searches for an XRDS document at the realm URL, and if found, searches /// for a description of a relying party endpoints (OpenId login pages). /// /// The mechanism to use for sending HTTP requests. /// Whether redirects may be followed when discovering the Realm. /// This may be true when creating an unsolicited assertion, but must be /// false when performing return URL verification per 2.0 spec section 9.2.1. /// /// The details of the endpoints if found, otherwise null. /// internal override IEnumerable DiscoverReturnToEndpoints(IDirectWebRequestHandler requestHandler, bool allowRedirects) { return this.relyingPartyDescriptions; } } }