- Publicity: Public Only All
token-procs.tcl
Account-bound, expiring action tokens. Client properties hold state within a session. Action tokens authorize a specific operation across sessions and are consumed transactionally.
- Location:
- packages/acs-authentication/tcl/token-procs.tcl
Procedures in this file
- auth::token::issue (public)
- auth::token::lock_account (private)
- auth::token::redeem (public)
- auth::token::revoke (public)
Detailed information
auth::token::issue (public)
auth::token::issue -purpose purpose -user_id user_id -ttl ttl \
[ -context context ]Issue a token, replacing the outstanding token for this account and purpose. Deliver the returned token only through the channel authorized by the caller. Use an application-defined purpose and keep context free of credentials.
- Switches:
- -purpose (required)
- -user_id (required)
- -ttl (required)
- Lifetime in seconds.
- -context (optional)
- Optional state for the redemption callback (up to 4000 bytes).
- Returns:
- The raw token, which is stored only as a digest.
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
auth::token::lock_account (private)
auth::token::lock_account user_id
Serialize token operations on the same account. Call inside a transaction.
- Parameters:
- user_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
auth::token::redeem (public)
auth::token::redeem -purpose purpose -token token -callback callback
Redeem a token for the expected purpose. The callback is a trusted command prefix. It receives the user ID and stored context as its final arguments and runs in the token transaction. It must enforce the operation's authorization rules. A normal return consumes the token. An error rolls back the operation and leaves the token available to retry until expiry. External side effects belong after commit.
- Switches:
- -purpose (required)
- -token (required)
- -callback (required)
- Returns:
- A dictionary with status invalid, or status redeemed and the callback result.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
auth::token::revoke (public)
auth::token::revoke -purpose purpose -user_id user_id
Revoke the outstanding token for this account and purpose. When called as part of an account update, take the token account lock before making the update and keep both operations in the same transaction.
- Switches:
- -purpose (required)
- -user_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.