Exemplo n.º 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);
        }
Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        internal async Task <List <SiteList> > GetSiteListsFromCache(bool isAdmin)
        {
            var key = GetCacheKey(isAdmin);

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

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

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

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

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

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

            return(await Cache.Get <List <ProfileProperty> >(key));
        }
Exemplo n.º 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));
        }