@deque/axe-auth 1.8.0-next.8b31a431 → 1.8.0-next.a39633c1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,13 +9,26 @@ export interface TokenDeps extends CommandDeps {
9
9
  /** Override the token store. Defaults to a fresh `KeyringTokenStore()`. */
10
10
  tokenStore?: TokenStore;
11
11
  }
12
+ /** Arguments for `axe-auth token`. */
13
+ export interface TokenArgs extends CommonArgs {
14
+ /**
15
+ * Undocumented on purpose: only the axe MCP server reads it (#1448). The
16
+ * server accepts axe-auth from its own release version up, so this shape may
17
+ * only gain fields until the next major version.
18
+ */
19
+ json?: boolean;
20
+ }
12
21
  /** `axe-auth token` — print a currently-valid access token to stdout. */
13
22
  declare const tokenCommand: {
14
23
  name: string;
15
24
  summary: string;
16
25
  helpText: string;
17
- options: {};
26
+ options: {
27
+ json: {
28
+ type: "boolean";
29
+ };
30
+ };
18
31
  requiresConfig: false;
19
- run(_args: CommonArgs, deps: TokenDeps): Promise<void>;
32
+ run(args: TokenArgs, deps: TokenDeps): Promise<void>;
20
33
  };
21
34
  export default tokenCommand;
@@ -10,9 +10,9 @@ const tokenCommand = {
10
10
  name: "token",
11
11
  summary: "Print a currently-valid access token to stdout, refreshing silently if needed.",
12
12
  helpText: token_help_1.HELP_TOKEN,
13
- options: {},
13
+ options: { json: { type: "boolean" } },
14
14
  requiresConfig: false,
15
- async run(_args, deps) {
15
+ async run(args, deps) {
16
16
  const getToken = deps.getToken ?? getValidAccessToken_1.getValidAccessToken;
17
17
  const tokenStore = deps.tokenStore ?? new tokenStore_1.KeyringTokenStore();
18
18
  const loaded = deps.loadedEntry ?? (await tokenStore.load());
@@ -34,6 +34,13 @@ const tokenCommand = {
34
34
  }
35
35
  throw err;
36
36
  }
37
+ if (args.json && loaded.ok) {
38
+ // Named for the user-facing `--server` / AXE_SERVER_URL, not the
39
+ // internal codename the stored entry uses.
40
+ const serverURL = loaded.entry.walnutURL;
41
+ deps.stdout.write(`${JSON.stringify({ accessToken: token, serverURL })}\n`);
42
+ return;
43
+ }
37
44
  deps.stdout.write(`${token}\n`);
38
45
  },
39
46
  };
@@ -29,6 +29,8 @@ flowchart TB
29
29
  cli <-- "tokens + issuer/client/walnutURL<br/>(versioned blob)" --> keychain
30
30
  cli -- "access token (stdout)" --> user
31
31
  cli -- "axe-auth run: spawn + supervise,<br/>access-token push (loopback POST /token)" --> mcp
32
+ mcp -- "spawns axe-auth token<br/>(saved sign-in, npm only)" --> cli
33
+ cli -- "access token + serverURL (stdout)" --> mcp
32
34
  ```
33
35
 
34
36
  **Components and their roles:**
@@ -40,7 +42,7 @@ flowchart TB
40
42
  5. **OS keychain**: the platform-native credential store accessed through [`@napi-rs/keyring`](https://www.npmjs.com/package/@napi-rs/keyring) — macOS Keychain, Windows Credential Manager, or Linux Secret Service (GNOME Keyring, KWallet). The CLI writes one entry per machine.
41
43
  6. **axe server**: the customer's deployment of the axe API. The CLI hits its `/api/sso-config` endpoint at the start of `login` to discover the Keycloak URL, realm, and OAuth client ID; no other CLI traffic flows through the axe server.
42
44
  7. **Customer Keycloak**: the OAuth authorization server for the customer's deployment. Issues access and refresh tokens. Federation between Keycloak and any upstream enterprise IdP (Okta, AAD, etc.) is the customer's concern and out of scope for this document.
43
- 8. **axe MCP server**: the server that `axe-auth run` launches and supervises. It receives freshly-minted access tokens pushed over loopback (`POST /token`) so a long session survives token expiry without a restart. Present only in the `run` flow, not in `login`/`token`/`logout`.
45
+ 8. **axe MCP server**: the server that `axe-auth run` launches and supervises. It receives freshly-minted access tokens pushed over loopback (`POST /token`) so a long session survives token expiry without a restart. An npm server started with no credential also runs `axe-auth token` itself, as a child process, to find out whether signing in with the saved session is enabled for the user's organization, and signs in with it only when it is; it reads only the access token and the axe server it was issued for from stdout, never the refresh token.
44
46
 
45
47
  `axe-auth` itself does **not** communicate with Deque's API services directly. The access tokens it produces are consumed by downstream tools, most notably the axe MCP server, which presents them to Deque's services as `Authorization: Bearer ...`. The one exception is `axe-auth run`, which supervises a running axe MCP server and pushes freshly-minted access tokens to it over a loopback (`127.0.0.1`) connection so a long session survives token expiry without a restart; it never sends the refresh token, only short-lived access tokens.
46
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/axe-auth",
3
- "version": "1.8.0-next.8b31a431",
3
+ "version": "1.8.0-next.a39633c1",
4
4
  "description": "CLI authentication utility for Deque services",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -37,11 +37,11 @@
37
37
  "ts-dedent": "^2.2.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@hono/node-server": "^2.1.4",
40
+ "@hono/node-server": "^2.1.6",
41
41
  "@types/cross-spawn": "^6.0.6",
42
42
  "@types/node": "^24.19.2",
43
43
  "c8": "^12.0.0",
44
- "hono": "^4.13.13",
44
+ "hono": "^4.13.16",
45
45
  "tsx": "^4.23.15",
46
46
  "typescript": "^6.0.3"
47
47
  },