private async Task <HmacAuthenticationHandler> BuildHandlerAsync() { var authHandler = new HmacAuthenticationHandler(_hmacRequirement.Object, _loggerFactory.Object, _urlEncoder.Object, _systemClock.Object, _optionsProvider.Object, _hashProviderFactory.Object, _signatureProvider.Object); await authHandler.InitializeAsync(new AuthenticationScheme(Constants.SecurityScheme, "HMAC", typeof(HmacAuthenticationHandler)), _httpContext); return(authHandler); }
public void OnSetup() { logger = new Mock <ILogger <HmacAuthenticationHandler> >(); var loggerFactory = new Mock <ILoggerFactory>(MockBehavior.Strict); loggerFactory.Setup(x => x.CreateLogger("Meerkat.Security.Authentication.HmacAuthenticationHandler")).Returns(logger.Object); var encoder = new Mock <UrlEncoder>(); var clock = new Mock <ISystemClock>(); var options = new HmacAuthenticationOptions(); var om = new Mock <IOptionsMonitor <HmacAuthenticationOptions> >(MockBehavior.Strict); om.Setup(x => x.Get(HmacAuthentication.AuthenticationScheme)).Returns(options); authenticator = new Mock <IHmacAuthenticator>(MockBehavior.Strict); handler = new HmacAuthenticationHandler(authenticator.Object, om.Object, loggerFactory.Object, encoder.Object, clock.Object); }