refactor: Remove silent handling of lifetime assignment
This commit is contained in:
parent
07b91f3a5f
commit
f3215e16f9
2 changed files with 2 additions and 8 deletions
|
|
@ -16,10 +16,7 @@ def get_api_auth_backend():
|
||||||
|
|
||||||
def get_jwt_strategy() -> JWTStrategy[models.UP, models.ID]:
|
def get_jwt_strategy() -> JWTStrategy[models.UP, models.ID]:
|
||||||
secret = os.getenv("FASTAPI_USERS_JWT_SECRET", "super_secret")
|
secret = os.getenv("FASTAPI_USERS_JWT_SECRET", "super_secret")
|
||||||
try:
|
lifetime_seconds = int(os.getenv("JWT_LIFETIME_SECONDS", "3600"))
|
||||||
lifetime_seconds = int(os.getenv("JWT_LIFETIME_SECONDS", "3600"))
|
|
||||||
except ValueError:
|
|
||||||
lifetime_seconds = 3600
|
|
||||||
|
|
||||||
return APIJWTStrategy(secret, lifetime_seconds=lifetime_seconds)
|
return APIJWTStrategy(secret, lifetime_seconds=lifetime_seconds)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,7 @@ def get_client_auth_backend():
|
||||||
from .default.default_jwt_strategy import DefaultJWTStrategy
|
from .default.default_jwt_strategy import DefaultJWTStrategy
|
||||||
|
|
||||||
secret = os.getenv("FASTAPI_USERS_JWT_SECRET", "super_secret")
|
secret = os.getenv("FASTAPI_USERS_JWT_SECRET", "super_secret")
|
||||||
try:
|
lifetime_seconds = int(os.getenv("JWT_LIFETIME_SECONDS", "3600"))
|
||||||
lifetime_seconds = int(os.getenv("JWT_LIFETIME_SECONDS", "3600"))
|
|
||||||
except ValueError:
|
|
||||||
lifetime_seconds = 3600
|
|
||||||
|
|
||||||
return DefaultJWTStrategy(secret, lifetime_seconds=lifetime_seconds)
|
return DefaultJWTStrategy(secret, lifetime_seconds=lifetime_seconds)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue