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; }
public async Task <SiteSetting> CreateOrUpdateSetting(SiteSetting setting) { var existingSetting = await GetSetting(setting.SettingName); if (existingSetting == null) { setting = await CreateSetting(setting); } else { setting.SiteSettingId = existingSetting.SiteSettingId; setting = await UpdateSetting(setting); } await Cache.Remove(GetCacheKey(setting.SettingName)); return(setting); }
public async Task InvalidateSiteListCache() { await Cache.Remove(GetCacheKey(false)); await Cache.Remove(GetCacheKey(true)); }
public async Task InvalidateUserRoleCache(int userId, bool isAdmin) { string key = GetCacheKey(userId, isAdmin); await Cache.Remove(key); }
public async Task InvalidateListEntryCache(int listId) { await Cache.Remove(GetCacheKey(listId, false)); await Cache.Remove(GetCacheKey(listId, true)); }
public async Task InvalidateUserCache(int userId) { var key = GetCacheKey(userId); await Cache.Remove(key); }
public async Task InvalidateAppCache(string clientId) { var Key = GetCacheKey(clientId); await Cache.Remove(Key); }
public async Task InvalidateUserProfilePropertiesCache(int userId) { await Cache.Remove(GetCacheKey(userId, true)); await Cache.Remove(GetCacheKey(userId, false)); }