public TemporaryAccessController(ICosmosDBHandler <TemporaryAccessUser> cosmosDBHandler, IConfiguration configuration)
        {
            _cosmosDBHandler = cosmosDBHandler;
            var accessDurationInDays = configuration["ApplensTemporaryAccess:AccessDurationInDays"];
            int temporaryAccessDays  = 7;

            int.TryParse(accessDurationInDays.ToString(), out temporaryAccessDays);
            temporaryAccessDurationInSeconds = temporaryAccessDays * 24 * 60 * 60;
        }
        public ResourceConfigService(ICosmosDBHandler <ResourceConfig> cosmosDbHandler, IConfiguration configuration)
        {
            resourceConfigDBHandler  = cosmosDbHandler;
            refreshIntervalInSeconds = configuration.GetValue("ResourceConfig:RefreshIntervalInSeconds", 1800);
            resourceConfigList       = new List <ResourceConfig>();
            serverMode = configuration.GetValue("ServerMode", string.Empty);

            if (!serverMode.Equals("internal", StringComparison.OrdinalIgnoreCase))
            {
                FetchResourceConfigFromCosmosDB();
            }
        }
        public SecurityGroupHandler(IHttpContextAccessor httpContextAccessor, IConfiguration configuration, ICosmosDBHandler <TemporaryAccessUser> cosmosDBHandler)
        {
            loggedInUsersCache = new Dictionary <string, Dictionary <string, CachedUser> >();
            var applensAccess  = new SecurityGroupConfig();
            var applensTesters = new SecurityGroupConfig();

            configuration.Bind("ApplensAccess", applensAccess);
            configuration.Bind("ApplensTesters", applensTesters);
            loggedInUsersCache.Add(applensAccess.GroupId, new Dictionary <string, CachedUser>());
            loggedInUsersCache.Add(applensTesters.GroupId, new Dictionary <string, CachedUser>());
            loggedInUsersCache.Add("TemporaryAccess", new Dictionary <string, CachedUser>());

            ClearLoggedInUserCache();
            _httpContextAccessor = httpContextAccessor;

            var accessDurationInDays = configuration["ApplensTemporaryAccess:AccessDurationInDays"];

            int.TryParse(accessDurationInDays.ToString(), out temporaryAccessDays);
            temporaryAccessExpiryInSeconds = temporaryAccessDays * 24 * 60 * 60;
            _cosmosDBHandler = cosmosDBHandler;
        }