//-----------------------------------------------------------------------
//
// Copyright (c) Outercurve Foundation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Threading;
using System.Threading.Tasks;
using DotNetOpenAuth.OpenId.ChannelElements;
using Validation;
///
/// Applies a custom security policy to certain OpenID security settings and behaviors.
///
public interface IProviderBehavior {
///
/// Applies a well known set of security requirements to a default set of security settings.
///
/// The security settings to enhance with the requirements of this profile.
///
/// Care should be taken to never decrease security when applying a profile.
/// Profiles should only enhance security requirements to avoid being
/// incompatible with each other.
///
void ApplySecuritySettings(ProviderSecuritySettings securitySettings);
///
/// Called when a request is received by the Provider.
///
/// The incoming request.
/// The cancellation token.
///
/// true if this behavior owns this request and wants to stop other behaviors
/// from handling it; false to allow other behaviors to process this request.
///
///
/// Implementations may set a new value to but
/// should not change the properties on the instance of
/// itself as that instance may be shared across many requests.
///
Task OnIncomingRequestAsync(IRequest request, CancellationToken cancellationToken);
///
/// Called when the Provider is preparing to send a response to an authentication request.
///
/// The request that is configured to generate the outgoing response.
/// The cancellation token.
///
/// true if this behavior owns this request and wants to stop other behaviors
/// from handling it; false to allow other behaviors to process this request.
///
Task OnOutgoingResponseAsync(IAuthenticationRequest request, CancellationToken cancellationToken);
}
}