Update key store to validate account and site
Docker Build and Release Upload / build (push) Successful in 1m24s

This commit is contained in:
2025-09-09 21:47:34 -07:00
parent 0e16bee869
commit f1222b4ec6
7 changed files with 52 additions and 23 deletions
+18 -6
View File
@@ -2,6 +2,8 @@ using Microsoft.AspNetCore.Mvc;
using System.Web.Http;
using StackExchange.Redis;
using Auth.Services.DatabaseService;
using Auth.Services;
using Auth.Entities;
namespace Auth.Controllers {
[ApiController]
@@ -18,16 +20,26 @@ namespace Auth.Controllers {
[Route("get")]
[HttpGet]
public async Task<ActionResult<string>> Get(string key) {
RedisValue result = await _redisdb.StringGetAsync(key);
return Ok(result.ToString());
public async Task<ActionResult<string>> Get(string JWT, string key) {
Account? account = AuthJWT.ValidateJWTToken(JWT);
if (account != null) {
RedisValue result = await _redisdb.StringGetAsync( account.Site + key);
return Ok(result.ToString());
} else {
return BadRequest("JWT Not Valid");
}
}
[Route("set")]
[HttpGet]
public async Task<ActionResult> Set(string key, string value) {
await _redisdb.StringSetAsync(key, value);
return Ok();
public async Task<ActionResult> Set(string JWT, string key, string value) {
Account? account = AuthJWT.ValidateJWTToken(JWT);
if (account != null) {
await _redisdb.StringSetAsync(account.Site + key, value);
return Ok();
} else {
return BadRequest("JWT Not Valid");
}
}
}