fix(oidc): re-validate tenant assignment on refresh rotation (BUNYIP-200) #241
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/bunyip-200-revalidate-tenant-on-refresh-rotation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refresh-token rotation copied the original /authorize selected_tenant_id onto every new token in the family and never re-checked it, so an at+jwt kept minting a stale tenant claim even after an admin revoked the user's tenant assignment.
handle_refresh_grant now mirrors the existing has_entitlement re-check: for a client whose tenant_claim_name IS NOT NULL it re-runs OAuthClientUserTenantRepository::assignments_for and rejects with invalid_grant (forcing a fresh /authorize) when the carried selected_tenant_id is no longer among the user's current assignments.
The admin tenant assign/unassign endpoints now revoke the affected user's OIDC refresh-token families for that client (new TokenRepository::revoke_client_user_refresh_tokens) so outstanding tokens cannot keep rotating the stale claim. unassign returns the deleted row so the handler knows the affected (user, tenant).
#BUNYIP-200