chore: refactor instance identity to be a SessionTokenProvider (#19566)

Refactors Agent instance identity to be a SessionTokenProvider.

Refactors the CLI to create Agent clients via a centralized function, rather than add-hoc via individual command handlers and their flags.

This allows commands besides `coder agent`, but which still use the agent identity, to support instance identity authentication.

Fixes #19111 by unifying all API requests to go thru the SessionTokenProvider for auth credentials.
This commit is contained in:
Spike Curtis
2025-09-03 10:38:42 +04:00
committed by GitHub
parent ee35ad3a57
commit 1354d84eb4
35 changed files with 640 additions and 478 deletions
+37
View File
@@ -40,3 +40,40 @@ fi
| Type | <code>string</code> |
Extract a field from the "extra" properties of the OAuth token.
### --agent-token
| | |
|-------------|---------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_AGENT_TOKEN</code> |
An agent authentication token.
### --agent-token-file
| | |
|-------------|--------------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_AGENT_TOKEN_FILE</code> |
A file containing an agent authentication token.
### --agent-url
| | |
|-------------|-------------------------------|
| Type | <code>url</code> |
| Environment | <code>$CODER_AGENT_URL</code> |
URL for an agent to access your deployment.
### --auth
| | |
|-------------|--------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_AGENT_AUTH</code> |
| Default | <code>token</code> |
Specify the authentication type to use for the agent.