diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/access/token.rs | 9 | ||||
| -rw-r--r-- | src/api/login.rs | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/access/token.rs b/src/access/token.rs index 51c2449..2aefcd7 100644 --- a/src/access/token.rs +++ b/src/access/token.rs @@ -48,10 +48,11 @@ pub(crate) struct Claims { /// Until when it may be refreshed (Unix ms): the login's end, or sooner for one that /// was given a lifetime of its own (it ends its session with it). pub(crate) session_exp: u64, - /// The login's end (Unix ms), as it logged in: what no refresh changes, a token cut - /// short included. An ended session is recorded until then (`registry::session_path`), - /// so it covers every token of the session, wherever it ends. 0 in a token from - /// before it was kept: `session_exp` then. + /// The login's end (Unix ms), as it logged in: the latest any token of the session + /// may be refreshed to (a login given a lifetime of its own ends with it), which no + /// refresh changes, a token cut short included. An ended session is recorded until + /// then (`registry::session_path`), so it covers every token of the session, wherever + /// it ends. Absent (0) in a token: `session_exp` then. #[serde(default)] pub(crate) login_exp: u64, /// Less than the user may do: only what these allow too. diff --git a/src/api/login.rs b/src/api/login.rs index 1c8aa44..c5cbe8d 100644 --- a/src/api/login.rs +++ b/src/api/login.rs @@ -262,6 +262,7 @@ fn new_login( let exp = now .saturating_add(lifetime_ms(state, lifetime)) .min(session_exp); + let session_exp = ended_with(session_exp, exp, lifetime); Claims { v: 1, swarm, @@ -271,7 +272,7 @@ fn new_login( iat: now, exp, session: token::new_session(), - session_exp: ended_with(session_exp, exp, lifetime), + session_exp, login_exp: session_exp, limit, } |
