//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.OpenId.RelyingParty { using System; using System.Diagnostics.Contracts; /// /// Applies a custom security policy to certain OpenID security settings and behaviors. /// [ContractClass(typeof(IRelyingPartyBehaviorContract))] public interface IRelyingPartyBehavior { /// /// 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(RelyingPartySecuritySettings securitySettings); /// /// Called when an authentication request is about to be sent. /// /// The request. /// /// Implementations should be prepared to be called multiple times on the same outgoing message /// without malfunctioning. /// void OnOutgoingAuthenticationRequest(IAuthenticationRequest request); /// /// Called when an incoming positive assertion is received. /// /// The positive assertion. void OnIncomingPositiveAssertion(IAuthenticationResponse assertion); } /// /// Contract class for the interface. /// [ContractClassFor(typeof(IRelyingPartyBehavior))] internal abstract class IRelyingPartyBehaviorContract : IRelyingPartyBehavior { /// /// Prevents a default instance of the class from being created. /// private IRelyingPartyBehaviorContract() { } #region IRelyingPartyBehavior 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 IRelyingPartyBehavior.ApplySecuritySettings(RelyingPartySecuritySettings securitySettings) { Requires.NotNull(securitySettings, "securitySettings"); } /// /// Called when an authentication request is about to be sent. /// /// The request. /// /// Implementations should be prepared to be called multiple times on the same outgoing message /// without malfunctioning. /// void IRelyingPartyBehavior.OnOutgoingAuthenticationRequest(IAuthenticationRequest request) { Requires.NotNull(request, "request"); } /// /// Called when an incoming positive assertion is received. /// /// The positive assertion. void IRelyingPartyBehavior.OnIncomingPositiveAssertion(IAuthenticationResponse assertion) { Requires.NotNull(assertion, "assertion"); } #endregion } }