public TenantTopicController( ILogger <TenantTopicController> logger, DaprClient daprClient, TenantCacheService tenantCacheService) { _logger = logger; _daprClient = daprClient; _tenantCacheService = tenantCacheService; }
public TenantStore( ILogger <TenantStore> logger, IStringLocalizer <TenantFrameworkResource> sl, DaprClient daprClient, TenantCacheService tenantCacheService) { _logger = logger; _sl = sl; _daprClient = daprClient; _tenantCacheService = tenantCacheService; }
public static async Task <Tenant> SearchTenantByIdAsync( ILogger logger, IStringLocalizer <TenantFrameworkResource> sl, TenantCacheService tenantCacheService, DaprClient daprClient, string tenantId) { try { string cacheKey = $"{CacheConstant.Tenant_}{tenantId}"; var tenant = await tenantCacheService.GetCacheAsync(daprClient, cacheKey); if (tenant == null) { var secretValues = await daprClient.GetSecretAsync(ConfigConstant.CodexKey, ConfigConstant.MicroserviceApiKey); var microserviceApiKey = secretValues[ConfigConstant.MicroserviceApiKey]; tenant = await daprClient.InvokeMethodAsync <Tenant>(ApiNameConstant.TenantApi, $"Tenant/{tenantId}", new HTTPExtension() { Verb = HTTPVerb.Get, Headers = { { HttpHeaderConstant.TenantId, tenantId }, { HttpHeaderConstant.ApiKey, $"{tenantId}.{microserviceApiKey}" } } } ); await tenantCacheService.UpdateCacheAsync(daprClient, cacheKey, tenant); return(tenant); } else { return(tenant); } } catch (Exception exception) { if (exception is Grpc.Core.RpcException rpcException && rpcException.Status.StatusCode == Grpc.Core.StatusCode.NotFound) { logger.LogInformation(rpcException, $"Tenant not found : '{tenantId}'"); throw new InvalidTenantIdException($"{sl[TenantFrameworkResource.TENANT_NOT_FOUND]!} : '{tenantId}'", "TENANT_NOT_FOUND"); } logger.LogError(exception, $"Unable to find Tenant {tenantId}"); throw new TechnicalException($"{sl[TenantFrameworkResource.TENANT_NOT_FOUND]!} : '{tenantId}'", "TENANT_NOT_FOUND"); } }
public UserMailService( ILogger <UserMailService> logger, IStringLocalizer <TenantFrameworkResource> sl, DaprClient daprClient, IRazorPartialToStringRenderer razorPartialToStringRenderer, IUserService userService, IMailService mailService, TenantCacheService tenantCacheService) { _logger = logger; _sl = sl; _daprClient = daprClient; _razorPartialToStringRenderer = razorPartialToStringRenderer; _userService = userService; _mailService = mailService; _tenantCacheService = tenantCacheService; }
public AuthenticationService( ILogger <AuthenticationService> logger, DaprClient daprClient, IPasswordHasher passwordHasher, IUserService userService, IConfiguration configuration, IRoleService roleService, TenantCacheService tenantCacheService, IStringLocalizer <UserResource> sl, IStringLocalizer <TenantFrameworkResource> tenantFrameworkSl) { _logger = logger; _daprClient = daprClient; _passwordHasher = passwordHasher; _userService = userService; _configuration = configuration; _roleService = roleService; _tenantCacheService = tenantCacheService; _sl = sl; _tenantFrameworkSl = tenantFrameworkSl; }