update token expiry for test openid server

This commit is contained in:
burnettk 2024-05-10 10:18:07 -04:00
parent 50754b9d33
commit 3dac7e9226
No known key found for this signature in database

View File

@ -123,12 +123,17 @@ def token() -> Response | dict:
host_url = _host_url_without_root_path() host_url = _host_url_without_root_path()
private_key = OpenIdConfigsForDevOnly.private_key private_key = OpenIdConfigsForDevOnly.private_key
# this is just for testing. there is no need to expire tokens rapidly.
one_hour = 3600
one_day = one_hour * 24
two_days = one_day * 2
id_token = jwt.encode( id_token = jwt.encode(
{ {
"iss": f"{host_url}{url_for('openid.index')}", "iss": f"{host_url}{url_for('openid.index')}",
"aud": client_id, "aud": client_id,
"iat": math.floor(time.time()), "iat": math.floor(time.time()),
"exp": round(time.time()) + 3600, "exp": round(time.time()) + two_days,
"sub": user_name, "sub": user_name,
"email": user_details["email"], "email": user_details["email"],
"preferred_username": user_details.get("preferred_username", user_name), "preferred_username": user_details.get("preferred_username", user_name),