IAuthenticationProvider.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #if !BESTHTTP_DISABLE_SIGNALR
  2. namespace BestHTTP.SignalR.Authentication
  3. {
  4. public delegate void OnAuthenticationSuccededDelegate(IAuthenticationProvider provider);
  5. public delegate void OnAuthenticationFailedDelegate(IAuthenticationProvider provider, string reason);
  6. public interface IAuthenticationProvider
  7. {
  8. /// <summary>
  9. /// The authentication must be run before any request made to build up the SignalR protocol
  10. /// </summary>
  11. bool IsPreAuthRequired { get; }
  12. /// <summary>
  13. /// This event must be called when the pre-authentication succeded. When IsPreAuthRequired is false, no-one will subscribe to this event.
  14. /// </summary>
  15. event OnAuthenticationSuccededDelegate OnAuthenticationSucceded;
  16. /// <summary>
  17. /// This event must be called when the pre-authentication failed. When IsPreAuthRequired is false, no-one will subscribe to this event.
  18. /// </summary>
  19. event OnAuthenticationFailedDelegate OnAuthenticationFailed;
  20. /// <summary>
  21. /// This function called once, when the before the SignalR negotiation begins. If IsPreAuthRequired is false, then this step will be skipped.
  22. /// </summary>
  23. void StartAuthentication();
  24. /// <summary>
  25. /// This function will be called for every request before sending it.
  26. /// </summary>
  27. void PrepareRequest(HTTPRequest request, RequestTypes type);
  28. }
  29. }
  30. #endif