public FridayCleanApi(FridayCleanApiSettings settings) { Settings = settings; //var asyncAuthInterceptor = new AsyncAuthInterceptor( (context, metadata) => //{ // metadata.Add(Constants.AuthHeaderName, Settings.AccessToken); // return Task.CompletedTask; //}); //var options = new List<ChannelOption> //{ // //move ssl creds to ioc // new ChannelOption(ChannelOptions.SslTargetNameOverride, Utils.Ssl.DefaultHostOverride) //}; //var channelCredentials = ChannelCredentials.Create(Utils.Ssl.CreateSslClientCredentials(), // CallCredentials.FromInterceptor(asyncAuthInterceptor)); _channel = new Channel($"{Settings.Host}:{Settings.Port}", Settings.ChannelCredentials, Settings.ChannelOptions); var interceptedChannel = _channel.Intercept(Settings.Interceptors.ToArray()); _client = new FridayCleanCommunication.FridayCleanCommunicationClient(interceptedChannel); }
private static FridayCleanApiSettings Default() { var settings = new FridayCleanApiSettings() { AccessToken = "", }; Action <CallOptions> callback = (CallOptions x) => x.Headers.Add(Constants.AuthHeaderName, settings.AccessToken); settings.Interceptors = new List <Interceptor>() { new AuthInterceptor(callback) }; return(settings); }