예제 #1
0
        public async Task <string> GetStrSetting(string settingName)
        {
            if (string.IsNullOrEmpty(settingName))
            {
                throw new CallerException("Valid Setting Name Required");
            }

            string settingValue = await Cache.Get <string>(GetCacheKey(settingName));

            if (settingValue != null)
            {
                return(settingValue);
            }

            var setting = await GetSetting(settingName);

            if (setting == null || setting.SettingValue == null)
            {
                settingValue = "";
            }
            else
            {
                settingValue = setting.SettingValue;
            }

            await Cache.Insert(GetCacheKey(settingName), settingValue, new TimeSpan(6, 0, 0));

            return(settingValue);
        }
예제 #2
0
        public async Task<int> ValidateCode(TokenRequest tokenRequest)
        {
            var codeData = await Cache.Get<AuthCodeData>(GetCacheKey(tokenRequest.Code));

            if (codeData == null)
            {
                throw new CallerException("Invalid code");
            }

            await Cache.Remove(GetCacheKey(tokenRequest.Code));

            if (codeData.ClientId != tokenRequest.ClientId)
            {
                throw new CallerException("Invalid client");
            }

            if (string.IsNullOrEmpty(codeData.CodeChallenge) || string.IsNullOrEmpty(tokenRequest.CodeVerifier))
            {
                throw new CallerException("Missing PKCE info");
            }

            VerifyCode(codeData.CodeChallenge, tokenRequest.CodeVerifier);

            return codeData.UserId;
        }
예제 #3
0
        public async Task <string> GetSetting(string settingName)
        {
            if (string.IsNullOrEmpty(settingName))
            {
                throw new CallerException("SettingName Cannot Be Blank");
            }

            string settingValue = await Cache.Get <string>(GetCacheKey(settingName));

            if (settingValue != null)
            {
                return(settingValue);
            }

            var settingLogic = new SettingsLogic(Cache, Context);

            settingValue = await settingLogic.GetStrSetting(settingName);

            return(settingValue);
        }
예제 #4
0
        internal async Task <List <SiteList> > GetSiteListsFromCache(bool isAdmin)
        {
            var key = GetCacheKey(isAdmin);

            return(await Cache.Get <List <SiteList> >(key));
        }
예제 #5
0
        internal async Task <List <UserRole> > GetUserRolesFromCache(int userId, bool isAdmin)
        {
            var key = GetCacheKey(userId, isAdmin);

            return(await Cache.Get <List <UserRole> >(key));
        }
예제 #6
0
        internal async Task <List <SiteListEntry> > GetSiteEntriesFromCache(int listId, bool isAdmin)
        {
            var key = GetCacheKey(listId, isAdmin);

            return(await Cache.Get <List <SiteListEntry> >(key));
        }
예제 #7
0
        public async Task <BudgetUser> GetUserFromCache(int userId)
        {
            var key = GetCacheKey(userId);

            return(await Cache.Get <BudgetUser>(key));
        }
예제 #8
0
        internal async Task <AppModel> GetAppFromCache(string clientId)
        {
            var Key = GetCacheKey(clientId);

            return(await Cache.Get <AppModel>(Key));
        }
예제 #9
0
        internal async Task <Page <UserSearchResponse> > GetSearchResponseFromCache(UserSearch searchOptions)
        {
            var key = GetCacheKey(searchOptions);

            return(await Cache.Get <Page <UserSearchResponse> >(key));
        }
예제 #10
0
        public async Task <List <ProfileProperty> > GetProfilePropertiesFromCache(bool requiredOnly, bool isAdmin)
        {
            var key = GetCacheKey(requiredOnly, isAdmin);

            return(await Cache.Get <List <ProfileProperty> >(key));
        }
예제 #11
0
        internal async Task <List <Role> > GetRolesFromCache(bool isAdmin)
        {
            var Key = GetCacheKey(isAdmin);

            return(await Cache.Get <List <Role> >(Key));
        }
        public async Task <List <UserProfileProperty> > GetUserProfilePropertiesFromCache(int userId, bool showAdminProperties)
        {
            var key = GetCacheKey(userId, showAdminProperties);

            return(await Cache.Get <List <UserProfileProperty> >(key));
        }