//-----------------------------------------------------------------------
//
// Copyright (c) Outercurve Foundation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Messages;
///
/// Handles messages coming into an OpenID Provider for which the entire
/// response message can be automatically determined without help from
/// the hosting web site.
///
internal class AutoResponsiveRequest : Request {
///
/// The response message to send.
///
private readonly IProtocolMessage response;
///
/// Initializes a new instance of the class.
///
/// The request message.
/// The response that is ready for transmittal.
/// The security settings.
internal AutoResponsiveRequest(IDirectedProtocolMessage request, IProtocolMessage response, ProviderSecuritySettings securitySettings)
: base(request, securitySettings) {
Requires.NotNull(response, "response");
this.response = response;
}
///
/// Initializes a new instance of the class
/// for a response to an unrecognizable request.
///
/// The response that is ready for transmittal.
/// The security settings.
internal AutoResponsiveRequest(IProtocolMessage response, ProviderSecuritySettings securitySettings)
: base(IndirectResponseBase.GetVersion(response), securitySettings) {
Requires.NotNull(response, "response");
this.response = response;
}
///
/// Gets a value indicating whether the response is ready to be sent to the user agent.
///
///
/// This property returns false if there are properties that must be set on this
/// request instance before the response can be sent.
///
public override bool IsResponseReady {
get { return true; }
}
///
/// Gets the response message, once is true.
///
internal IProtocolMessage ResponseMessageTestHook {
get { return this.ResponseMessage; }
}
///
/// Gets the response message, once is true.
///
protected override IProtocolMessage ResponseMessage {
get { return this.response; }
}
}
}