Class JobGrants

java.lang.Object
com.kingsrook.qqq.backend.core.jobs.JobGrants

public final class JobGrants extends Object
Job grants (owner-approved design, spec 2026-10-15-cluster-ha-design item 6): how a worker node runs a user's durable job as that user - with the user's CURRENT permissions, never more than at launch, and never through a tokenless super-session. At launch, the web node binds the job to the launching sign-in: it encrypts that session's id (AES-GCM, key derived from QQQ_JOB_GRANT_KEY, bound to the job and user) and signs job id + user id + encrypted session + launch scope + expiry (HMAC-SHA256, another derived key). The grant is kept in the job's credential scope. At each claim, the worker verifies the signature and expiry (a tampered or expired grant fails the job), decrypts the session id, and asks the authentication module to rebuild that session the normal way - for OAuth2, from the stored (encrypted) access/refresh tokens, so the provider confirms the user is still signed in and their groups are current. JobSessions then intersects the result with the launch scope. A sign-in that has ended (logout, revoked or expired refresh token, max session lifetime) fails the job cleanly; nothing escalates.