feat: Identify client at login/refresh (M2-10999) - #2097
Open
sricharan-varanasi wants to merge 4 commits into
Open
feat: Identify client at login/refresh (M2-10999)#2097sricharan-varanasi wants to merge 4 commits into
sricharan-varanasi wants to merge 4 commits into
Conversation
adeiji
reviewed
Jul 21, 2026
| return access_payload, refresh_payload | ||
|
|
||
| @staticmethod | ||
| def _assert_lifetimes_unchanged( |
Contributor
There was a problem hiding this comment.
nit: Just a thought, do you feel the name of this function truly represents what it does?
adeiji
approved these changes
Jul 21, 2026
adeiji
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me, just made one comment that is non-blocking.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Curious open source credit page
📝 Description
🔗 Jira Ticket M2-10999
Part of the session-timeout project: mobile will keep long-lived tokens while web/admin move to short-lived ones (follow-up ticket). Before we can vary token lifetime by client, the backend needs to reliably know - and remember for the life of a session - which client (
web/admin/mobile) each token belongs to. This PR only adds that identification; it makes no change to token lifetimes or any other behavior.All three clients already send a
Mindlogger-Content-Sourceheader on every request. This PR reads it at token-issuance time and embeds it as a new optionalclientJWT claim, propagated through refresh so it survives for the whole session, and surfaced in audit events for observability.Changes include:
get_optional_mindlogger_content_source: valid header → the client name; missing or invalid header →None("unknown"), never a guess. (The existingget_mindlogger_content_source, which defaults unknown toweb, is left untouched since another endpoint still depends on that behavior.) Guessing "unknown → web" would have been dangerous here: mobile app versions released earlier might not send the header, and misclassifying them aswebwould eventually give them a short-lived token in the follow-up ticket.clientclaim onTokenPayload, so tokens issued before this deploys keep parsing withclient = None- no forced re-login on rollout.clientis embedded in both the access and refresh token at all three token-issuance points: plain login, MFA-TOTP verification, and MFA-recovery-code verification.clientclaim from the incoming refresh token onto the newly minted access token (and onto the reprinted refresh token in the rare signing-key-transition path), so the claim persists across renewals instead of being lost after the first refresh.client.source, for visibility into rollout (e.g. spotting mobile clients still not sending the header).✏️ Notes