refresh tokens 0.1.2

This commit is contained in:
2026-07-23 20:51:26 +03:00
parent 7199387e6f
commit eab78b6679
8 changed files with 369 additions and 46 deletions

View File

@@ -8,6 +8,7 @@ class Base(BaseModel):
model_config = {"from_attributes": True}
class PermissionsCreate(Base):
permission:Annotated[str, Field(..., max_length=30, description="permission name")]
@@ -67,14 +68,18 @@ class UserUpdate(Base):
class RefreshTokensCreate(Base):
id:Annotated[UUID, Field(..., description="jti")]
user_id:Annotated[UUID, Field(..., description="foreign key for the user")]
token_hash:Annotated[str, Field(...,max_length=255, description="token hash")]
device_info:Annotated[str, Field(...,max_length=255, description="User device info")]
ip_address:Annotated[str, Field(...,max_length=45, description="ip v4/v6 of the user")]
is_revoked:Annotated[bool|None, Field(None, description="revoke token if logout was made")]
expires_at:Annotated[datetime, Field(..., description="when token is going to be expired")]
class RefreshTokensUpdate(Base):
is_revoked:Annotated[bool, Field(..., description="revoke token if logout was made")]
replaced_by:Annotated[UUID, Field(...,description="old_jti")]
class RefreshTokensOut(Base):
user_id:Annotated[UUID, Field(..., description="foreign key for the user")]
@@ -83,3 +88,7 @@ class RefreshTokensOut(Base):
ip_address:Annotated[str, Field(...,max_length=45, description="ip v4/v6 of the user")]
is_revoked:Annotated[bool|None, Field(None, description="revoke token if logout was made")]
expires_at:Annotated[datetime, Field(..., description="when token is going to be expired")]
replaced_by:Annotated[UUID|None, Field(..., description="Old refresh token")]
class RefreshRequest(Base):
refresh_token:str