@snyk/jwt-cli 0.11.6 → 0.14.4
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 +33 -2
- package/bin/jwt +1 -1
- package/bin/jwt-darwin-arm64 +0 -0
- package/bin/jwt-darwin-x64 +0 -0
- package/bin/jwt-linux-arm64 +0 -0
- package/bin/jwt-linux-x64 +0 -0
- package/bin/jwt.exe +0 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# jwt-cli
|
|
2
|
+
|
|
2
3
|
A simple CLI tool to create signed JWTs with some asymetric key generation thrown in for fun.
|
|
3
4
|
|
|
4
5
|
Using this tool you can quickly create RSA256 key pairs, mint a JWT and have your public key available in either PEM or JWKS format.
|
|
@@ -15,12 +16,12 @@ npm i -g @snyk/jwt-cli
|
|
|
15
16
|
|
|
16
17
|
or the Go toolchain:
|
|
17
18
|
```shell
|
|
18
|
-
go install github.com/snyk/jwt-cli/cmd/jwt@
|
|
19
|
+
go install github.com/snyk/jwt-cli/cmd/jwt@latest
|
|
19
20
|
```
|
|
20
21
|
|
|
21
22
|
or using docker:
|
|
22
23
|
```
|
|
23
|
-
docker pull us-docker.pkg.dev/polaris-gcp-gar/polaris/jwt:latest
|
|
24
|
+
docker pull us-docker.pkg.dev/polaris-gcp-gar/polaris/jwt-cli:latest
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
or using nix:
|
|
@@ -161,6 +162,36 @@ You can change the claims in the JWT by creating a claims JSON file:
|
|
|
161
162
|
}
|
|
162
163
|
```
|
|
163
164
|
|
|
165
|
+
The `tid` (tenant ID) and `rctx` (resource context) claims are optional and only
|
|
166
|
+
emitted when present. `rctx` maps a resource UUID to its type and, optionally,
|
|
167
|
+
a list of permissions granted on it:
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"iss": "http://localhost",
|
|
171
|
+
"aud": "http://localhost",
|
|
172
|
+
"sub": "85b14cf2-af5e-4fc7-9821-453605446f01",
|
|
173
|
+
"azp": "2459210b-dd78-43ae-b0af-b8bad46f8b17",
|
|
174
|
+
"ptype": "user",
|
|
175
|
+
"tid": "1d6b9a1e-2c3d-4e5f-8a9b-0c1d2e3f4a5b",
|
|
176
|
+
"rctx": {
|
|
177
|
+
"e80ba71c-ae46-472c-a3d4-d5f4123046d9": { "t": "org", "p": ["read", "edit"] }
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The `ttype` (token type) claim defaults to `principal_authn` and is always
|
|
183
|
+
emitted. Set it in your claims file to override the default:
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"iss": "http://localhost",
|
|
187
|
+
"aud": "http://localhost",
|
|
188
|
+
"sub": "85b14cf2-af5e-4fc7-9821-453605446f01",
|
|
189
|
+
"azp": "2459210b-dd78-43ae-b0af-b8bad46f8b17",
|
|
190
|
+
"ptype": "user",
|
|
191
|
+
"ttype": "service_authn"
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
164
195
|
Once you have your claims in a json file, simply use the `--claims` flag to target it:
|
|
165
196
|
```shell
|
|
166
197
|
$ jwt create -c jwt-claims.json
|
package/bin/jwt
CHANGED
package/bin/jwt-darwin-arm64
CHANGED
|
Binary file
|
package/bin/jwt-darwin-x64
CHANGED
|
Binary file
|
package/bin/jwt-linux-arm64
CHANGED
|
Binary file
|
package/bin/jwt-linux-x64
CHANGED
|
Binary file
|
package/bin/jwt.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snyk/jwt-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "0.14.4",
|
|
4
4
|
"description": "jwt-cli is a little command line tool to create jwts locally",
|
|
5
5
|
"bin": {
|
|
6
6
|
"jwt": "bin/jwt"
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"engines": {
|
|
18
18
|
"node": ">=4.4.0"
|
|
19
19
|
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
20
23
|
"repository": {
|
|
21
24
|
"type": "git",
|
|
22
25
|
"url": "git+https://github.com/snyk/jwt-cli.git"
|