//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Test.Mocks { using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId; using Validation; 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) { Requires.NotNull(relyingPartyDescriptions, "relyingPartyDescriptions"); 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 host factories. /// 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 cancellation token. /// /// The details of the endpoints if found, otherwise null. /// internal override Task> DiscoverReturnToEndpointsAsync(IHostFactories hostFactories, bool allowRedirects, CancellationToken cancellationToken) { return Task.FromResult>(this.relyingPartyDescriptions); } } }