feat: service token introduction
This commit is contained in:
@@ -3,8 +3,17 @@ from pydantic import BaseModel, Field
|
||||
from core.exp import get_exp
|
||||
from schemas.providers import ProvidersType
|
||||
|
||||
type NumericDate = int | float
|
||||
|
||||
class JWTPayload(BaseModel):
|
||||
|
||||
class UserJWTPayload(BaseModel):
|
||||
sub: str = Field(description="User ID")
|
||||
iss: ProvidersType = Field(description="Issuer")
|
||||
exp: float = Field(default_factory=get_exp)
|
||||
exp: NumericDate = Field(default_factory=get_exp)
|
||||
|
||||
|
||||
class ServiceJWTPayload(BaseModel):
|
||||
iss: str = Field(description="Service name")
|
||||
iat: NumericDate = Field(description="Issued at")
|
||||
exp: NumericDate = Field(description="Expiration date")
|
||||
acting_as: str = Field(description="Subject of issued call, formatted as `service:id`")
|
||||
|
||||
Reference in New Issue
Block a user