namespace MvcRelyingParty { using System; using System.Collections.Generic; using System.Linq; using System.Web; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.RelyingParty; public interface IOpenIdRelyingParty { Channel Channel { get; } IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo); IEnumerable CreateRequests(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo); IAuthenticationResponse GetResponse(); IAuthenticationResponse GetResponse(HttpRequestInfo request); } /// /// A wrapper around the standard class. /// public class OpenIdRelyingPartyService : IOpenIdRelyingParty { /// /// The OpenID relying party to use for logging users in. /// /// /// This is static because it is thread-safe and is more expensive /// to create than we want to run through for every single page request. /// private static OpenIdRelyingParty relyingParty = new OpenIdRelyingParty(); /// /// Initializes a new instance of the class. /// public OpenIdRelyingPartyService() { } #region IOpenIdRelyingParty Members public Channel Channel { get { return relyingParty.Channel; } } public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo) { return relyingParty.CreateRequest(userSuppliedIdentifier, realm, returnTo); } public IEnumerable CreateRequests(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo) { return relyingParty.CreateRequests(userSuppliedIdentifier, realm, returnTo); } public IAuthenticationResponse GetResponse() { return relyingParty.GetResponse(); } public IAuthenticationResponse GetResponse(HttpRequestInfo request) { return relyingParty.GetResponse(request); } #endregion } }