@canopy-io/nestjs 0.7.3 → 0.7.5
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 +14 -0
- package/README.md +5 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @canopy-io/nestjs
|
|
2
2
|
|
|
3
|
+
## 0.7.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d09cbb1: The README registers `CanopyModule` with `isGlobal: true` and says why: guarded controllers usually live in feature modules, and without it their guards cannot resolve the token verifier and the application refuses to start. No code change; the option has always existed and still defaults to `false`.
|
|
8
|
+
|
|
9
|
+
## 0.7.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [056f64d]
|
|
14
|
+
- Updated dependencies [4a092d0]
|
|
15
|
+
- @canopy-io/node@0.18.0
|
|
16
|
+
|
|
3
17
|
## 0.7.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ import { CanopyModule } from "@canopy-io/nestjs";
|
|
|
34
34
|
@Module({
|
|
35
35
|
imports: [
|
|
36
36
|
CanopyModule.forRoot<AuthedRequest>({
|
|
37
|
+
isGlobal: true,
|
|
37
38
|
apiKey: process.env.CANOPY_API_KEY,
|
|
38
39
|
verify: { environmentId: process.env.CANOPY_ENVIRONMENT_ID },
|
|
39
40
|
resolveIdentity: (request) => request.user?.sub,
|
|
@@ -44,7 +45,9 @@ import { CanopyModule } from "@canopy-io/nestjs";
|
|
|
44
45
|
export class AppModule {}
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
`
|
|
48
|
+
Register it once, in the root module. `isGlobal: true` makes its providers visible to the guards in your feature modules, where guarded controllers usually live; without it, a guard outside the registering module cannot resolve its token verifier and the application refuses to start. It defaults to `false`, as `@nestjs/config` does.
|
|
49
|
+
|
|
50
|
+
`verify` names the Environment whose tokens the module accepts (`environmentId`, or `issuer` on a custom auth domain or a self-hosted instance; a self-hosted instance can instead set `CANOPY_BASE_URL` for the process, which `environmentId` and the client both follow). It is required: the module builds its token verifier at startup.
|
|
48
51
|
|
|
49
52
|
The two resolvers are how the guard learns _who_ is asking and _where_. Where those live is your application's business — a claim on a verified token, a route parameter, a tenant on the session — so you supply them rather than the library guessing. Pass your own request type to `forRoot` and both resolvers are typed against it.
|
|
50
53
|
|
|
@@ -52,6 +55,7 @@ When the key comes from something injectable, use `forRootAsync`:
|
|
|
52
55
|
|
|
53
56
|
```ts
|
|
54
57
|
CanopyModule.forRootAsync({
|
|
58
|
+
isGlobal: true,
|
|
55
59
|
imports: [ConfigModule],
|
|
56
60
|
inject: [ConfigService],
|
|
57
61
|
useFactory: (config: ConfigService) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopy-io/nestjs",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
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.18.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@nestjs/common": "^10.0.0 || ^11.0.0",
|