/// <summary> /// Creates authenticated client backed by the specified channel. The supplied /// signer is used to authenticate the caller for every call. /// </summary> /// <param name = "channel">RPC channel to use</param> /// <param name = "memberId">member id</param> /// <param name = "crypto">engine to use for signing requests, tokens, etc</param> /// <returns>newly created client</returns> public static Client Authenticated( ManagedChannel channel, string memberId, ICryptoEngine crypto) { return(new Client(memberId, crypto, channel)); }
/// <summary> /// Builds and returns a new <see cref="TokenClient"/> instance. /// </summary> /// <returns>the <see cref="TokenClient"/> instance</returns> public TokenClient Build() { var channelOptions = new List <ChannelOption>(); channelOptions.Add(new ChannelOption("grpc.keepalive_permit_without_calls", keepAlive ? 1 : 0)); channelOptions.Add(new ChannelOption("grpc.keepalive_time_ms", keepAliveTimeMs)); var channel = new Channel( hostName, port, useSsl ? new SslCredentials() : ChannelCredentials.Insecure, channelOptions); Interceptor[] interceptors = { new AsyncTimeoutInterceptor(timeoutMs), new AsyncMetadataInterceptor(metadata => { metadata.Add("token-sdk", "csharp"); metadata.Add( "token-sdk-version", Assembly.GetExecutingAssembly().GetName().Version.ToString(3)); metadata.Add("token-dev-key", devKey); return(metadata); }) }; var newChannel = new ManagedChannel(channel, interceptors); return(new TokenClient( newChannel, cryptoEngine ?? new TokenCryptoEngineFactory(new InMemoryKeyStore()), tokenCluster ?? TokenCluster.SANDBOX)); }
/// <summary> /// Creates an instance of a Token SDK. /// </summary> /// <param name="channel">the gRPC channel</param> /// <param name="cryptoEngineFactory">the crypto factory to create crypto engine</param> /// <param name="tokenCluster">the token cluster to connect to</param> public TokenClient( ManagedChannel channel, ICryptoEngineFactory cryptoEngineFactory, TokenCluster tokenCluster) { this.channel = channel; this.cryptoEngineFactory = cryptoEngineFactory; this.tokenCluster = tokenCluster; }
protected void AddRemoveChannel(ManagedChannel channel, ChangeEventArgs e) { if ((bool)e.Value) { ScanProfile.Channels.Add(channel); } else { ScanProfile.Channels.Remove(channel); } IsChanged = true; }
/// <summary> /// Builds and returns a new <see cref="TokenClient"/> instance. /// </summary> /// <returns>the <see cref="TokenClient"/> instance</returns> public virtual TokenClient Build() { var metadata = GetHeaders(); var newChannel = ManagedChannel.NewBuilder(hostName, port, useSsl) .WithTimeout(timeoutMs) .WithMetadata(metadata) .UseKeepAlive(keepAlive) .WithKeepAliveTime(keepAliveTimeMs) .Build(); return(new TokenClient( newChannel, cryptoEngine ?? new TokenCryptoEngineFactory(new InMemoryKeyStore()), tokenCluster ?? TokenCluster.SANDBOX)); }
/// <summary> /// Builds and returns a new <see cref="TokenClient"/> instance. /// </summary> /// <returns>the <see cref="TokenClient"/> instance</returns> public TokenClient Build() { var channel = new Channel(hostName, port, useSsl ? new SslCredentials() : ChannelCredentials.Insecure); Interceptor[] interceptors = { new AsyncTimeoutInterceptor(timeoutMs), new AsyncMetadataInterceptor(metadata => { metadata.Add("token-sdk", "csharp"); metadata.Add( "token-sdk-version", Assembly.GetExecutingAssembly().GetName().Version.ToString(3)); metadata.Add("token-dev-key", devKey); return(metadata); }) }; var newChannel = new ManagedChannel(channel, interceptors); return(new TokenClient( newChannel, cryptoEngine ?? new TokenCryptoEngineFactory(new InMemoryKeyStore()), tokenCluster ?? TokenCluster.SANDBOX)); }
/// <summary> /// Instantiates a client. /// </summary> /// <param name="memberId">the member id</param> /// <param name="cryptoEngine">the crypto engine used to sign for authentication, request /// payloads, etc</param> /// <param name="channel">managed channel</param> public Client(string memberId, ICryptoEngine cryptoEngine, ManagedChannel channel) : base(memberId, cryptoEngine, channel) { }
/// <summary> /// Creates new unauthenticated client backed by the specified channel. /// </summary> /// <param name = "channel">RPC channel to use</param> /// <returns>newly created client</returns> public static UnauthenticatedClient Unauthenticated(ManagedChannel channel) { return(new UnauthenticatedClient(new GatewayService.GatewayServiceClient(channel.BuildInvoker()))); }
protected override void ReplaceSoundFile(ManagedChannel channel = null) { }
protected bool IsChecked(ManagedChannel channel) => ScanProfile.Channels.Contains(channel);