Allow lifetime_seconds to be None to get session cookies

This commit is contained in:
François Voron
2021-03-19 18:19:58 +01:00
parent 902bcdb8d2
commit ef4a54c204
10 changed files with 20 additions and 15 deletions

View File

@ -19,7 +19,7 @@ def generate_state_token(
data: Dict[str, str], secret: str, lifetime_seconds: int = 3600
) -> str:
data["aud"] = STATE_TOKEN_AUDIENCE
return generate_jwt(data, lifetime_seconds, secret, JWT_ALGORITHM)
return generate_jwt(data, secret, lifetime_seconds, JWT_ALGORITHM)
def decode_state_token(token: str, secret: str) -> Dict[str, str]:

View File

@ -33,8 +33,8 @@ def get_reset_password_router(
token_data = {"user_id": str(user.id), "aud": RESET_PASSWORD_TOKEN_AUDIENCE}
token = generate_jwt(
token_data,
reset_password_token_lifetime_seconds,
reset_password_token_secret,
reset_password_token_lifetime_seconds,
)
if after_forgot_password:
await run_handler(after_forgot_password, user, token, request)

View File

@ -49,8 +49,8 @@ def get_verify_router(
}
token = generate_jwt(
token_data,
verification_token_lifetime_seconds,
verification_token_secret,
verification_token_lifetime_seconds,
)
if after_verification_request: