@canopy-io/nestjs 0.9.4 → 0.9.6
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/CHANGELOG.md +17 -0
- package/README.md +13 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @canopy-io/nestjs
|
|
2
2
|
|
|
3
|
+
## 0.9.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eaee2f6: Follows Canopy's release that gives Direct API tokens an audience: a Direct API access token names the id of the Environment that issued it in `aud`, as a Hosted Login token names its OAuth client. `TokenVerifier`'s `audience` (and `verify.audience` in `CanopyModule`) now takes a list as well as one value, and accepts a token whose `aud` includes any of them, so one verifier with `[clientId, environmentId]` accepts both sign-in kinds of one Environment and refuses a token for another client. A verifier with no `audience` still refuses a token that carries `aud` (`token.audience_unverified`), and its message now names what to set for each sign-in kind; a token with no `aud` is still refused when an audience is set. Machine tokens are still held to `serviceAudience` alone.
|
|
8
|
+
- Updated dependencies [f1fca62]
|
|
9
|
+
- Updated dependencies [eaee2f6]
|
|
10
|
+
- @canopy-io/node@0.27.0
|
|
11
|
+
|
|
12
|
+
## 0.9.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 907bfbb: `LocalAuthorizer` revalidates a subject's grants instead of re-reading them. A refresh sends the `ETag` the held grants came with as `If-None-Match`, and Canopy answers an unchanged subject with `304` after reading only its access versions, so the grants stay in memory and only their expiry moves. Changed grants are read in full, as before. The cache time and what it promises are unchanged: a change still takes effect within `ttlMs`, and a grant still starts or ends at its window's edge. `snapshot()` adds `grantNotModified`. The generated types follow Canopy's current spec, which adds the grants `304` and two branding operations (`ApiBrandingController_uploadImage`, `ApiBrandingController_previewLink`), not wrapped yet. No caller changes are needed.
|
|
17
|
+
- Updated dependencies [907bfbb]
|
|
18
|
+
- @canopy-io/node@0.26.0
|
|
19
|
+
|
|
3
20
|
## 0.9.4
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# @canopy-io/nestjs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Authorize a NestJS app's routes with [Canopy](https://canopy-io.com): a permission check becomes a decorator on the route instead of a call in every handler.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Which package
|
|
6
|
+
|
|
7
|
+
- **A NestJS app:** this package. It installs [`@canopy-io/node`](https://www.npmjs.com/package/@canopy-io/node) and hands you its client for everything the guard does not cover.
|
|
8
|
+
- **Any other server:** [`@canopy-io/node`](https://www.npmjs.com/package/@canopy-io/node).
|
|
6
9
|
|
|
7
10
|
## Install
|
|
8
11
|
|
|
@@ -165,7 +168,9 @@ CanopyModule.forRoot<AuthedRequest>({
|
|
|
165
168
|
apiKey: process.env.CANOPY_API_KEY,
|
|
166
169
|
verify: {
|
|
167
170
|
environmentId: process.env.CANOPY_ENVIRONMENT_ID,
|
|
168
|
-
|
|
171
|
+
// Hosted Login: your OAuth client id. Direct API: your Environment id.
|
|
172
|
+
// Both: list them.
|
|
173
|
+
audience: process.env.CANOPY_OAUTH_CLIENT_ID,
|
|
169
174
|
},
|
|
170
175
|
resolveIdentity: (request) => request.canopyToken?.sub,
|
|
171
176
|
});
|
|
@@ -320,7 +325,7 @@ So two things are held, split by what they depend on:
|
|
|
320
325
|
|
|
321
326
|
and a check is a walk up from the node in question looking for a grant root. An `app_wide` check is simpler still: the permission appearing at all is the answer, and no hierarchy is needed.
|
|
322
327
|
|
|
323
|
-
**Both are held for at most 60 seconds**, which is therefore the delay between an access change and it taking effect. `authorizationTtlMs` changes it, up to five minutes (`300_000`); a longer value throws at startup.
|
|
328
|
+
**Both are held for at most 60 seconds**, which is therefore the delay between an access change and it taking effect. `authorizationTtlMs` changes it, up to five minutes (`300_000`); a longer value throws at startup. Both are revalidated rather than re-read: a conditional request for the first page that normally answers `304`, so nothing transfers. Both reads are paged and read in full, 100 rows to a page; when the grants or the hierarchy have changed, every page of them is read again (see [`LocalAuthorizer`](../node#authorizing-without-a-call-per-request) for how a rebuild over several pages is kept consistent).
|
|
324
329
|
|
|
325
330
|
```ts
|
|
326
331
|
CanopyModule.forRoot({
|
|
@@ -390,11 +395,11 @@ A hit costs nothing. A miss reads from Canopy on the request path and holds an i
|
|
|
390
395
|
|
|
391
396
|
The read itself is deliberately **not** cancelled: it may be shared with other requests that are still waiting on it, and it warms the cache either way.
|
|
392
397
|
|
|
393
|
-
##
|
|
398
|
+
## Learn more
|
|
394
399
|
|
|
395
|
-
[
|
|
396
|
-
|
|
397
|
-
|
|
400
|
+
- [SDKs and Libraries](https://canopy-io.com/docs/sdks-and-libraries)
|
|
401
|
+
- [Authorization caching](https://canopy-io.com/docs/authorization-caching)
|
|
402
|
+
- [Changelog](./CHANGELOG.md): the package is pre-1.0, so a minor version may carry a breaking change. Read the entry before upgrading.
|
|
398
403
|
|
|
399
404
|
## License
|
|
400
405
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopy-io/nestjs",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "Official NestJS integration for Canopy \u2014 hierarchical identity and access management.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Canopy Identity Inc.",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"test:watch": "vitest"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@canopy-io/node": "^0.
|
|
65
|
+
"@canopy-io/node": "^0.27.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@nestjs/common": "^10.0.0 || ^11.0.0",
|