diff --git a/src/Helpers/Constants.cs b/src/Helpers/Constants.cs index 6b57f6f7..ef16d943 100644 --- a/src/Helpers/Constants.cs +++ b/src/Helpers/Constants.cs @@ -57,7 +57,6 @@ public class Constants public static readonly string? AWS_ACCESS_KEY_ID; public static readonly string? AWS_SECRET_ACCESS_KEY; public static readonly string API_TOKEN_SALT; - public static readonly bool GRPC_AUTH_FEATURE_FLAG; // Crons & Jobs public static readonly string MONITOR_WITHDRAWALS_CRON = "10 0/5 * * * ?"; @@ -166,8 +165,6 @@ static Constants() API_TOKEN_SALT = Environment.GetEnvironmentVariable("API_TOKEN_SALT") ?? "H/fCx1+maAFMcdi6idIYEg=="; - GRPC_AUTH_FEATURE_FLAG = Environment.GetEnvironmentVariable("GRPC_AUTH_FEATURE_FLAG") == "true"; - // Crons & Jobs MONITOR_WITHDRAWALS_CRON = Environment.GetEnvironmentVariable("MONITOR_WITHDRAWALS_CRON") ?? MONITOR_WITHDRAWALS_CRON; diff --git a/src/Properties/launchSettings.json b/src/Properties/launchSettings.json index 2c8f153c..4557b415 100644 --- a/src/Properties/launchSettings.json +++ b/src/Properties/launchSettings.json @@ -49,7 +49,6 @@ "COINGECKO_KEY": "TBD", "HTTP1_LISTEN_PORT": "38080", "API_TOKEN_SALT": "H/fCx1+maAFMcdi6idIYEg==", - "GRPC_AUTH_FEATURE_FLAG": "false" } } } diff --git a/src/Rpc/GRPCAuthInterceptor.cs b/src/Rpc/GRPCAuthInterceptor.cs index 7b55e46a..350da0ff 100644 --- a/src/Rpc/GRPCAuthInterceptor.cs +++ b/src/Rpc/GRPCAuthInterceptor.cs @@ -18,20 +18,17 @@ public override async Task UnaryServerHandler( ServerCallContext context, UnaryServerMethod continuation) { - - if (Constants.GRPC_AUTH_FEATURE_FLAG) { - var token = context.RequestHeaders.FirstOrDefault(x => x.Key == "auth-token")?.Value; - if (token == null) - { - throw new RpcException(new Status(StatusCode.Unauthenticated, "No token provided")); - } + var token = context.RequestHeaders.FirstOrDefault(x => x.Key == "auth-token")?.Value; + if (token == null) + { + throw new RpcException(new Status(StatusCode.Unauthenticated, "No token provided")); + } - var apiToken = await _apiTokenRepository.GetByToken(token); - - if (apiToken?.IsBlocked ?? true) - { - throw new RpcException(new Status(StatusCode.Unauthenticated, "Invalid token")); - } + var apiToken = await _apiTokenRepository.GetByToken(token); + + if (apiToken?.IsBlocked ?? true) + { + throw new RpcException(new Status(StatusCode.Unauthenticated, "Invalid token")); } return await continuation(request, context);