//-----------------------------------------------------------------------
//
// Copyright (c) Outercurve Foundation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Diagnostics.Contracts;
using DotNetOpenAuth.OpenId.ChannelElements;
///
/// Applies a custom security policy to certain OpenID security settings and behaviors.
///
[ContractClass(typeof(IProviderBehaviorContract))]
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.
///
/// 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.
///
bool OnIncomingRequest(IRequest request);
///
/// Called when the Provider is preparing to send a response to an authentication request.
///
/// The request that is configured to generate the outgoing response.
///
/// 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.
///
bool OnOutgoingResponse(IAuthenticationRequest request);
}
///
/// Code contract for the type.
///
[ContractClassFor(typeof(IProviderBehavior))]
internal abstract class IProviderBehaviorContract : IProviderBehavior {
///
/// Initializes a new instance of the class.
///
protected IProviderBehaviorContract() {
}
#region IProviderBehavior Members
///
/// 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 IProviderBehavior.ApplySecuritySettings(ProviderSecuritySettings securitySettings) {
Requires.NotNull(securitySettings, "securitySettings");
throw new System.NotImplementedException();
}
///
/// Called when a request is received by the Provider.
///
/// The incoming request.
///
/// 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.
///
bool IProviderBehavior.OnIncomingRequest(IRequest request) {
Requires.NotNull(request, "request");
throw new System.NotImplementedException();
}
///
/// Called when the Provider is preparing to send a response to an authentication request.
///
/// The request that is configured to generate the outgoing response.
///
/// 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.
///
bool IProviderBehavior.OnOutgoingResponse(IAuthenticationRequest request) {
Requires.NotNull(request, "request");
throw new System.NotImplementedException();
}
#endregion
}
}