models.py 730 B

1234567891011121314151617181920212223242526272829
  1. from pydantic import BaseModel
  2. from typing import Optional
  3. import datetime
  4. SECRET_KEY = "df2f77bd544240801a048bd4293afd8eeb7fff3cb7050e42c791db4b83ebadcd"
  5. ALGORITHM = "HS256"
  6. class Token(BaseModel):
  7. access_token: str
  8. token_type: str
  9. class User(BaseModel):
  10. username: str
  11. password: str
  12. changPwdTime: Optional[datetime.datetime] = None
  13. isAdmin: Optional[bool] = None
  14. isEnable: Optional[bool] = True
  15. updateTime: Optional[datetime.datetime] = None
  16. token: Optional[str] = None
  17. # AuthJWT setting
  18. class Settings(BaseModel):
  19. authjwt_secret_key: str = SECRET_KEY
  20. authjwt_token_location: set = {"cookies"}
  21. authjwt_cookie_secure: bool = False
  22. authjwt_cookie_csrf_protect: bool = True