20 lines
623 B
Python
20 lines
623 B
Python
from pydantic import BaseModel, Field
|
|
|
|
from core.exp import get_exp
|
|
from schemas.providers import ProvidersType
|
|
|
|
type NumericDate = int | float
|
|
|
|
|
|
class UserJWTPayload(BaseModel):
|
|
sub: str = Field(description="User ID")
|
|
iss: ProvidersType = Field(description="Issuer")
|
|
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`")
|