🎉 Initial commit for DysonNetwork.Gateway

This commit is contained in:
2025-07-15 18:30:53 +08:00
parent 8fbc81cab9
commit 21b42b5b21
12 changed files with 372 additions and 5 deletions

View File

@@ -15,8 +15,8 @@ public static class DysonAuthStartup
{
var etcdClient = sp.GetRequiredService<IEtcdClient>();
var config = sp.GetRequiredService<IConfiguration>();
var clientCertPath = config["Service:ClientCert"];
var clientKeyPath = config["Service:ClientKey"];
var clientCertPath = config["Service:ClientCert"]!;
var clientKeyPath = config["Service:ClientKey"]!;
var clientCertPassword = config["Service:CertPassword"];
return GrpcClientHelper
@@ -24,6 +24,20 @@ public static class DysonAuthStartup
.GetAwaiter()
.GetResult();
});
services.AddSingleton<PermissionService.PermissionServiceClient>(sp =>
{
var etcdClient = sp.GetRequiredService<IEtcdClient>();
var config = sp.GetRequiredService<IConfiguration>();
var clientCertPath = config["Service:ClientCert"]!;
var clientKeyPath = config["Service:ClientKey"]!;
var clientCertPassword = config["Service:CertPassword"];
return GrpcClientHelper
.CreatePermissionServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword)
.GetAwaiter()
.GetResult();
});
services.AddAuthentication(options =>
{