public IdentityController(
     ILogger <HRController> logger,
     Authorization.AuthorizationClient authorizationClient)
 {
     _logger = logger;
     _authorizationClient = authorizationClient;
 }
示例#2
0
        public static void Main()
        {
            var channel    = GrpcChannel.ForAddress("https://localhost:5001");
            var client     = new Greeter.GreeterClient(channel);
            var authClient = new Authorization.AuthorizationClient(channel);

            authClient.Login(new LoginRequest()
            {
                Login = "******", Password = "******"
            });                                                                             // cookie is already set after this call
            var user  = "******";
            var reply = client.SayHello(new HelloRequest {
                Name = user
            });

            Console.WriteLine("Greeting: " + reply.Message);
            channel.ShutdownAsync().Wait();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
示例#3
0
        public static void Main()
        {
            var channel    = GrpcChannel.ForAddress("https://localhost:5001");
            var client     = new Greeter.GreeterClient(channel);
            var authClient = new Authorization.AuthorizationClient(channel);
            var authReply  = authClient.Login(new LoginRequest()
            {
                Login = "******", Password = "******"
            });
            var metadata = new Metadata();

            metadata.Add("Authorization", $"Bearer {authReply.JwtToken}");
            var user  = "******";
            var reply = client.SayHello(new HelloRequest {
                Name = user
            }, metadata);

            Console.WriteLine("Greeting: " + reply.Message);
            channel.ShutdownAsync().Wait();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }