[] 서버 접근을 위한 인증 API 생성

This commit is contained in:
김선규 2025-03-13 15:47:51 +09:00
parent 3e3a644203
commit 96d8999317
2 changed files with 14 additions and 2 deletions

View File

@ -26,13 +26,13 @@ public class JwtTokenService
_logger = logger;
}
public string GenerateJwtToken(string uid)//, string role)
public string GenerateJwtToken(string jwtKey)//, string role)
{
// 1. 클레임(Claim) 설정 - 필요에 따라 추가 정보도 포함
var claims = new List<Claim>
{
// 토큰 주체(sub) 생성을 위해 값으로 uid를 사용함 : 토큰이 대표하는 고유 식별자
new Claim(JwtRegisteredClaimNames.Sub, uid),
new Claim(JwtRegisteredClaimNames.Sub, jwtKey),
// Jti 는 토큰 식별자로 토큰의 고유 ID 이다.
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
// jwt 토큰이 가지는 권한

View File

@ -65,4 +65,16 @@ public class AppController : ControllerBase
return StatusCode(500, APIResponse.UnknownError);
}
}
[HttpGet("auth")]
[CustomOperation("서버 접근 권한 확인", "서버 기능을 사용하기 위한 접근에 대해 권한 확인", "시스템")]
public async Task<IActionResult> AuthProgram(string key)
{
return Ok(APIResponse.Send("000", "OK", Empty));
}
}