#if !BESTHTTP_DISABLE_SIGNALR_CORE
using System;
namespace BestHTTP.SignalRCore
{
public delegate void OnAuthenticationSuccededDelegate(IAuthenticationProvider provider);
public delegate void OnAuthenticationFailedDelegate(IAuthenticationProvider provider, string reason);
public interface IAuthenticationProvider
{
///
/// The authentication must be run before any request made to build up the SignalR protocol
///
bool IsPreAuthRequired { get; }
///
/// This event must be called when the pre-authentication succeded. When IsPreAuthRequired is false, no-one will subscribe to this event.
///
event OnAuthenticationSuccededDelegate OnAuthenticationSucceded;
///
/// This event must be called when the pre-authentication failed. When IsPreAuthRequired is false, no-one will subscribe to this event.
///
event OnAuthenticationFailedDelegate OnAuthenticationFailed;
///
/// This function called once, when the before the SignalR negotiation begins. If IsPreAuthRequired is false, then this step will be skipped.
///
void StartAuthentication();
///
/// This function will be called for every request before sending it.
///
void PrepareRequest(HTTPRequest request);
///
/// This function can customize the given uri. If there's no intention to modify the uri, this function should return with the parameter.
///
Uri PrepareUri(Uri uri);
///
/// Cancel any ongoing authentication.
///
void Cancel();
}
}
#endif