@gjermundgaraba/clankerauth-dev 0.4.0 → 0.5.1
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 +14 -0
- package/dist/THIRD_PARTY_NOTICES.txt +1 -28
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +38 -38
- package/dist/web/assets/index-BtTQ7_kn.js +53 -0
- package/dist/web/index.html +1 -1
- package/package.json +2 -2
- package/dist/web/assets/index-HxNynbde.js +0 -53
package/README.md
CHANGED
|
@@ -30,6 +30,20 @@ await issuer.close();
|
|
|
30
30
|
|
|
31
31
|
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.
|
|
32
32
|
|
|
33
|
+
To develop an app behind forward auth, pass a `cookieDomain`:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
const issuer = await startDisposableIssuer({
|
|
37
|
+
resources: [{ identifier: "http://app.notes.localhost:8080/api", name: "Notes", scopes: [] }],
|
|
38
|
+
client: { name: "Notes console", redirect: "http://localhost:5173/callback", resources: [] },
|
|
39
|
+
cookieDomain: "notes.localhost",
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
issuer.url; // http://auth.notes.localhost:<port>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
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`. Node's `fetch` always sends `Sec-Fetch-Mode: cors`, so a proxy written in Node must make the check with `node:http` to relay the browser's header. Without `cookieDomain` the issuer is `http://127.0.0.1:<port>` and these routes are not served.
|
|
46
|
+
|
|
33
47
|
Two optional test hooks help exercise integrations:
|
|
34
48
|
|
|
35
49
|
- `cimdTransport(input, init)` replaces outbound Client ID Metadata Document retrieval and returns a `Response` or `Promise<Response>`. Its arguments match `fetch`. Use it to serve fixture metadata for HTTPS client IDs without an external server. When omitted, the issuer uses its secure metadata transport.
|
|
@@ -472,7 +472,7 @@ SOFTWARE.
|
|
|
472
472
|
|
|
473
473
|
---
|
|
474
474
|
|
|
475
|
-
@gjermundgaraba/effect-actions@0.
|
|
475
|
+
@gjermundgaraba/effect-actions@0.2.0
|
|
476
476
|
LICENSE
|
|
477
477
|
MIT License
|
|
478
478
|
|
|
@@ -1399,33 +1399,6 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
1399
1399
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1400
1400
|
|
|
1401
1401
|
|
|
1402
|
-
---
|
|
1403
|
-
|
|
1404
|
-
oauth4webapi@3.8.8
|
|
1405
|
-
LICENSE.md
|
|
1406
|
-
The MIT License (MIT)
|
|
1407
|
-
|
|
1408
|
-
Copyright (c) 2022 Filip Skokan
|
|
1409
|
-
|
|
1410
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1411
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
1412
|
-
in the Software without restriction, including without limitation the rights
|
|
1413
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1414
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
1415
|
-
furnished to do so, subject to the following conditions:
|
|
1416
|
-
|
|
1417
|
-
The above copyright notice and this permission notice shall be included in all
|
|
1418
|
-
copies or substantial portions of the Software.
|
|
1419
|
-
|
|
1420
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1421
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1422
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1423
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1424
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1425
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1426
|
-
SOFTWARE.
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
1402
|
---
|
|
1430
1403
|
|
|
1431
1404
|
redis@6.2.1
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export interface DisposableIssuerOptions {
|
|
2
2
|
resources: Array<{ identifier: string; name: string; scopes: string[] }>;
|
|
3
3
|
client: { name: string; redirect: string; resources: string[] };
|
|
4
|
+
/**
|
|
5
|
+
* Serve forward auth for apps under this domain, such as `notes.localhost`. The issuer is
|
|
6
|
+
* then `http://auth.<cookieDomain>:<port>` on the same loopback listener, and the forward
|
|
7
|
+
* cookie is shared with every host under the domain. Without it, the issuer is
|
|
8
|
+
* `http://127.0.0.1:<port>` and the forward-auth routes are not served.
|
|
9
|
+
*/
|
|
10
|
+
cookieDomain?: string;
|
|
4
11
|
/** Test hook replacing outbound CIMD metadata retrieval. Defaults to the secure transport. */
|
|
5
12
|
cimdTransport?: (input: RequestInfo | URL, init?: RequestInit) => Response | Promise<Response>;
|
|
6
13
|
/** Test hook observing incoming HTTP requests, including provisioning. No headers or bodies. */
|