Caffeine.Identity API
Caffeine Framework의 인증·인가 모듈 API 레퍼런스입니다.
NuGet: dotnet add package NEXCODE.Caffeine.Identity
.NET 버전: .NET 10.0
인증 방식
| 클라이언트 | 인증 방식 | 토큰 |
|---|---|---|
| Blazor Server Admin | Cookie 인증 | 세션 쿠키 |
| REST/gRPC API | JWT Bearer | Access Token (1시간) |
JWT 토큰 발급
POST /api/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password",
"tenantId": "tenant-id"
}
응답:
{
"accessToken": "eyJ...",
"refreshToken": "...",
"expiresIn": 3600
}
API 보호
// 기본 인증 필수
[Authorize]
public class DevicesController : ControllerBase { }
// 역할 기반 접근
[Authorize(Roles = "Admin")]
public IActionResult AdminOnly() { }
// 익명 허용
[AllowAnonymous]
public IActionResult Public() { }
토큰 갱신
POST /api/auth/refresh
Authorization: Bearer {access_token}
Content-Type: application/json
{ "refreshToken": "..." }
내부 구현 상세
DI 등록 전략, 멀티 테넌트 구조, SQLite Identity 설정 상세는 내부 문서를 참조하세요.