private static void RegisterServices(IServiceCollection services, IConfigurationSection config)
        {
            var options = new HmacOptions(new SecretsFromConfig(config.GetSection("Secrets")));

            config.Bind(options);

            RegisterServices(services, options);
        }
 public static HmacAuthenticationService Create(HmacOptions options)
 {
     return(new HmacAuthenticationService(
                options.AppSecretRepository,
                options.Algorithm,
                new HmacRequestDateValidator(options.Time, options.ClockSkew),
                new HmacSignatureContentResolver(new RequestUrlResolver(options.RequestProtocol, options.Host))));
 }
Example #3
0
 public static void UseHmac(this IAppBuilder app, HmacOptions options)
 {
     app.Use <HmacMiddleware>(options);
 }
 public HmacAuthenticationOptions(HmacOptions options) : base(Schemas.HMAC)
 {
     Hmac = options;
 }
 public HmacMiddleware(OwinMiddleware next, HmacOptions middlewareOptions)
     : base(next)
 {
     authenticationService = HmacAuthenticationService.Create(middlewareOptions);
 }
 private static void RegisterServices(this IServiceCollection services, HmacOptions options)
 {
     services.AddSingleton <IHmacAuthenticationService>(HmacAuthenticationService.Create(options));
 }
 public static AuthenticationBuilder AddHmacAuthentication(this AuthenticationBuilder builder, HmacOptions options)
 {
     RegisterServices(builder.Services, options);
     return(builder.AddScheme <AuthenticationSchemeOptions, HmacAuthenticationHandler>(Schemas.HMAC, o => { }));
 }
 public static void AddHmac(this IServiceCollection services, HmacOptions options) => RegisterServices(services, options);
 public HmacServerHandler(HmacOptions options, bool mixedMode = false)
 {
     authenticationService = HmacAuthenticationService.Create(options);
     this.mixedMode        = mixedMode;
 }