public static void AddDigitServiceClient(this IServiceCollection services, DigitServiceOptions options, IAuthenticationProviderBuilder authenticationProviderBuilder) { var factory = authenticationProviderBuilder.GetFactory(); services.Configure <DigitServiceOptions>(v => { v.DigitServiceBaseUri = options.DigitServiceBaseUri; v.LogAuthor = options.LogAuthor; }); services.AddTransient <IDigitServiceClient>(v => new DigitServiceClient(factory(v), v.GetService <IOptions <DigitServiceOptions> >())); }
public DigitServiceClient(IAuthenticationProvider authenticationProvider, IOptions <DigitServiceOptions> optionsAccessor) { options = optionsAccessor.Value; this.authenticationProvider = authenticationProvider; }