about summary refs log tree commit diff
path: root/scripts/gn-auth-stub.py
AgeCommit message (Collapse)Author
12 daysai-instruction: issue a token per user without gn-authPjotr
The page told the operator to mint with POST /get-test-token, which is gn-auth's dev password grant and does not exist in the deployment being set up. Issuing a second user's token also had no good answer: the stub minted exactly one token per process, so a new user meant starting a throwaway instance, grabbing --token-file and killing it. So add --mint-only: mint for --subject, print, write --token-file and exit without listening. Verification only depends on the key (committed, so shared by every instance) and on iss, which now falls back to AUTH_SERVER_URL -- a token minted this way verifies against the long-running stub untouched. * scripts/gn-auth-stub.py (main): --mint-only; --issuer defaults to AUTH_SERVER_URL before the port-derived default. Docstring says how a second user's token is issued. * docs/www/ai-instruction.md (1. Get a token): the operator's command is the stub, not /get-test-token; the token lasts whatever --expires-in said rather than an hour, and there is no early revocation. (4. What is public): minting is operator-side. Appendix: "Token issuance" rewritten around the stub -- public-data-only, expiry as the only revocation, sub as attribution, one token per user -- with gn-auth kept as what replaces it later; the stub is no longer listed as a dev leftover to delete, but as the auth server that must never be routed publicly. * README.md (Tests): mention --mint-only next to the stub's other flags.
12 daysgn-auth-stub: --expires-in, document the public-data-only tokenPjotr
A stub token had a fixed 24h lifetime, and nothing said what an ungranted one can reach. Both matter for the case that is not a test run: handing a caller or an agent a long-lived token that may only read public data. An ungranted stub token already is exactly that -- the restriction lives in the authorisation lookup genenetwork4 consults for anything not public, not in the token's scope -- so only the lifetime was missing. * scripts/gn-auth-stub.py (duration): new helper, "30d"/"24h"/"60m"/s. (sign): take expires_in instead of a hard-coded 86400. (main): --expires-in, defaulting to 24h as before; docstring says what an ungranted token can reach and why the key's fixity makes a month-long token safe. * README.md (Tests): the public-data-only token, what stays visible (dataset metadata), the --expires-in example and the iss/port coupling.
12 daysgn-auth-stub: bind before writing the token filePjotr
A second instance started while one is already listening used to write its own token to --token-file (and print it) before failing to bind, leaving a token nothing was serving in the place the first instance's token was expected -- tests then failed as if the stub had issued it. Bind first, then write and print. * scripts/gn-auth-stub.py (main): construct the server before writing --token-file or printing the token.
12 daystests: run against a real database and index, with a gn-auth stubPjotr
The suites skip rather than fail whatever needs a database, an index or a token they cannot get, which is right in the build sandbox but leaves most endpoints unexercised. With a live MariaDB, a full Xapian index (GN4_FULL_INDEX) and a token, the same commands run the whole suite: 225 Rust tests pass with 0 failures, and the Python suite runs all 94 with no skips -- as against 77 skipped without them. The token was the only piece with no local stand-in, so add scripts/gn-auth-stub.py: it serves the JWKS matching the committed test key, answers /auth/token (so POST /get-test-token works) and answers both authorisation endpoints with "no privileges", the stranger case the non-public 403 tests assert. --grant-resource-id grants one resource id to the fixture token for the owner-side tests. * scripts/gn-auth-stub.py: new file. * README.md (Tests): "Against a real database and index", what the three inputs are, the full run, and what still skips and why.