@gjermundgaraba/clankerauth-dev 0.7.2 → 0.9.0
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.
- package/README.md +5 -5
- package/dist/THIRD_PARTY_NOTICES.txt +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +38 -38
- package/dist/testing.mjs +1 -1
- package/dist/web/assets/index-Bi2toh59.js +53 -0
- package/dist/web/index.html +2 -2
- package/package.json +5 -5
- package/dist/web/assets/index-CeRYhIQg.js +0 -53
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @gjermundgaraba/clankerauth-dev
|
|
2
2
|
|
|
3
|
-
A disposable [
|
|
3
|
+
A disposable [clankerauth](https://github.com/gjermundgaraba/clankerauth) issuer for developing and testing applications that authenticate against one. The package bundles the whole server and dashboard with no dependencies, so it needs only Node 26 or newer.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
npm install --save-dev @gjermundgaraba/clankerauth-dev
|
|
@@ -26,7 +26,7 @@ issuer.clientSecret;
|
|
|
26
26
|
await issuer.close();
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Each call listens on a random loopback port, creates a fresh SQLite database and secret in a temporary directory, provisions the owner, the resources and the client in-process through the server's administration module, and returns. Only the returned issuer is reached over HTTP. The client is first party: once the owner is signed in, an authorization request redirects straight to the callback with a code and no consent step. `close()` drains in-flight requests, closes the database and deletes the directory. Nothing is shared between calls and nothing survives them.
|
|
29
|
+
Each call listens on a random loopback port, creates a fresh SQLite database and secret in a temporary directory, provisions the owner, the resources and the client in-process through the server's administration module, and returns. Only the returned issuer is reached over HTTP. The client is first party: once the owner is signed in, an authorization request redirects straight to the callback with a code and no consent step. `close()` drains in-flight requests, closes the database and deletes the directory. Nothing is shared between calls and nothing survives them. A start that fails, for example on an invalid `cookieDomain`, rejects after doing the same, so it leaves no port bound and nothing to close.
|
|
30
30
|
|
|
31
31
|
## Provisioning
|
|
32
32
|
|
|
@@ -50,7 +50,7 @@ const token = await issuer.ownerToken({
|
|
|
50
50
|
Pass `dataDir` and a fixed `port` to keep the issuer's state:
|
|
51
51
|
|
|
52
52
|
```ts
|
|
53
|
-
const issuer = await startDisposableIssuer({ ...options, dataDir: ".dev/
|
|
53
|
+
const issuer = await startDisposableIssuer({ ...options, dataDir: ".dev/clankerauth", port: 5174 });
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
The owner account and password, the signing secret, the registered client and the database are kept in that directory, and provisioning is idempotent, so the next start reuses them: the same sign-in works, API keys minted before still verify, and browser storage keyed by the origin survives. A fixed port is part of that, because the origin is what cookies and registered redirect URIs are keyed by. `close()` leaves the directory alone. Treat it as the whole secret of the workspace and keep it out of version control. `credentials.json` is written and read by this package alone and is validated against its schema on every start, so an edited or truncated file is refused rather than half-read. Without `dataDir`, nothing changes: a temporary directory, a random port, and everything removed by `close()`.
|
|
@@ -64,7 +64,7 @@ const issuer = await startDisposableIssuer({
|
|
|
64
64
|
cookieDomain: "notes.localhost",
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
issuer.url; // http://
|
|
67
|
+
issuer.url; // http://clankerauth.notes.localhost:<port>
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
The issuer then serves `/forward-auth?resource=<identifier>`, `/forward-auth/continue` and `/forward-auth/logout`, and shares its forward cookie with every host under the domain, so serve the app on one, such as `app.notes.localhost`. Browsers and Node resolve `.localhost` names to loopback without a hosts-file entry. A signed-in owner's check answers `204` with an `Authorization` header to copy upstream; without a session, a page navigation (`Sec-Fetch-Mode: navigate`) is redirected through sign-in and any other request is `401`. Without `cookieDomain` the issuer is `http://127.0.0.1:<port>` and these routes are not served.
|
|
@@ -79,7 +79,7 @@ import { forwardAuth, reserveLoopbackPort } from "@gjermundgaraba/clankerauth-de
|
|
|
79
79
|
export default defineConfig({
|
|
80
80
|
plugins: [
|
|
81
81
|
forwardAuth({
|
|
82
|
-
issuer: "http://
|
|
82
|
+
issuer: "http://clankerauth.notes.localhost:5174",
|
|
83
83
|
appOrigin: "http://app.notes.localhost:5173",
|
|
84
84
|
resource: "http://app.notes.localhost:5173/",
|
|
85
85
|
sockets: { backend: "http://127.0.0.1:8080", paths: ["/eventlog"] },
|
|
@@ -418,7 +418,7 @@ SOFTWARE.
|
|
|
418
418
|
|
|
419
419
|
---
|
|
420
420
|
|
|
421
|
-
@effect/platform-node-shared@4.0.0-rc.
|
|
421
|
+
@effect/platform-node-shared@4.0.0-rc.117
|
|
422
422
|
LICENSE
|
|
423
423
|
MIT License
|
|
424
424
|
|
|
@@ -445,7 +445,7 @@ SOFTWARE.
|
|
|
445
445
|
|
|
446
446
|
---
|
|
447
447
|
|
|
448
|
-
@effect/platform-node@4.0.0-rc.
|
|
448
|
+
@effect/platform-node@4.0.0-rc.117
|
|
449
449
|
LICENSE
|
|
450
450
|
MIT License
|
|
451
451
|
|
|
@@ -472,7 +472,7 @@ SOFTWARE.
|
|
|
472
472
|
|
|
473
473
|
---
|
|
474
474
|
|
|
475
|
-
@gjermundgaraba/effect-actions@0.
|
|
475
|
+
@gjermundgaraba/effect-actions@0.7.0
|
|
476
476
|
LICENSE
|
|
477
477
|
MIT License
|
|
478
478
|
|
|
@@ -1294,7 +1294,7 @@ SOFTWARE.
|
|
|
1294
1294
|
|
|
1295
1295
|
---
|
|
1296
1296
|
|
|
1297
|
-
effect@4.0.0-rc.
|
|
1297
|
+
effect@4.0.0-rc.117
|
|
1298
1298
|
LICENSE
|
|
1299
1299
|
MIT License
|
|
1300
1300
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface DisposableIssuerOptions {
|
|
|
3
3
|
client: { name: string; redirect: string; resources: string[] };
|
|
4
4
|
/**
|
|
5
5
|
* Serve forward auth for apps under this domain, such as `notes.localhost`. The issuer is
|
|
6
|
-
* then `http://
|
|
6
|
+
* then `http://clankerauth.<cookieDomain>:<port>` on the same loopback listener, and the forward
|
|
7
7
|
* cookie is shared with every host under the domain. Without it, the issuer is
|
|
8
8
|
* `http://127.0.0.1:<port>` and the forward-auth routes are not served.
|
|
9
9
|
*/
|