@snyk/jwt-cli 0.7.0 → 0.8.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 CHANGED
@@ -23,6 +23,11 @@ or using docker:
23
23
  docker pull gcr.io/snyk-main/jwt:latest
24
24
  ```
25
25
 
26
+ or using nix:
27
+ ```shell
28
+ nix-env -i git+ssh://git@github.com/snyk/jwt-cli
29
+ ```
30
+
26
31
  ## Create a JWT
27
32
  To create a token, first you're going to need some keys:
28
33
 
@@ -44,6 +49,12 @@ $ jwt create
44
49
  eyJhbGciOiJSUzI1NiIsImtpZCI6Imp3dC1jbGkta2V5IiwidHlwIjoiSldUIn0.eyJhdWQiOiJodHRwOi8vbG9jYWxob3N0IiwiYXpwIjoiMWVmZmJlZTUtZGY4ZS00YWU4LTlhNGQtOTJlNGYwMWE4YjQ0IiwiZW50cyI6IiIsImV4cCI6MTY0NjU3OTE1MCwiaWF0IjoxNjQ2NTc5MDkwLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0IiwicHR5cGUiOiJ1c2VyIiwic3ViIjoiZDExMDhiNmYtODM0OS00ZWQxLWI1ZTgtYWY0OTM4OWNiNWQwIn0.RfN5o30tVC-oNnoj5uDDH27TcUxSOFBXLwsd6hqJeYqm4AheV4F4OT5O9CbpK7V9WV3C41i5iN1L5WNjEOR2xtHxVb-nOmKWlwIN2_0B9s03A0FhSbeNKcKKU5K6umLL9f-H03X778i5LoArlOCrOBp6zywK8K8LIuDdGY8erY5ITs_1z8ABafakpZGlAvD2OuJdZX56zTRh_7yJ6lBGVeFWNgIoBK2QlEutVv4o9rWZUIZqsnte1SBu4tXXuk3ykSNrX4p2nFAP08Z-hg78C8ExBrAK7udxo0hdj7Dy27LF8YN0UzD7FD7dbGUyb9AMZk1Iy_lEhMUEQGHAUezq8Q
45
50
  ```
46
51
 
52
+ You can launch a proxy server that creates a JWT and adds it as `Authorization` header to an HTTP request on the fly:
53
+ ```shell
54
+ $ jwt proxy -r localhost:8081
55
+ Proxying HTTP requests from localhost:80 to localhost:8081
56
+ ```
57
+
47
58
  You can also serve the public key for your signed token via JWKS with:
48
59
  ```shell
49
60
  $ jwt serve
@@ -61,10 +72,13 @@ When using the provided docker image, you will need to mount a volume to interac
61
72
  docker run -v $(pwd)/keys:/keys gcr.io/snyk-main/jwt:latest keys -o /keys
62
73
 
63
74
  # creating jwt from keys under ./keys
64
- docker run -v $(pwd)/keys:/keys gcr.io/snyk-main/jwt:latest create -i /keys/jwt_private_key.pem
75
+ docker run -v $(pwd)/keys:/keys gcr.io/snyk-main/jwt:latest create -i /keys/jwt_private_key.pem
76
+
77
+ # proxying requests adding authorization headers on the fly
78
+ docker run -v $(pwd)/keys:/keys gcr.io/snyk-main/jwt:latest proxy -a 0.0.0.0 -i /keys/jwt_private_key.pem -p 8080 -r destination-service:8080
65
79
 
66
80
  # serving jwks from keys under ./keys
67
- docker run -v $(pwd)/keys:/keys gcr.io/snyk-main/jwt:latest serve -i /keys/jwt_private_key.pem -p 8080
81
+ docker run -v $(pwd)/keys:/keys gcr.io/snyk-main/jwt:latest serve -a 0.0.0.0 -i /keys/jwt_private_key.pem -p 8080
68
82
  ```
69
83
 
70
84
  ## Validate your JWT
@@ -152,6 +166,23 @@ Once you have your claims in a json file, simply use the `--claims` flag to targ
152
166
  $ jwt create -c jwt-claims.json
153
167
  ```
154
168
 
169
+ ### Proxy
170
+ ```shell
171
+ $ jwt help proxy
172
+ NAME:
173
+ jwt proxy - proxy requests setting a JWT as authorization bearer token
174
+
175
+ USAGE:
176
+ jwt proxy [command options] [arguments...]
177
+
178
+ OPTIONS:
179
+ --address value, -a value address to serve from (default: localhost)
180
+ --claims value, -c value relative path to a JSON file containing claims
181
+ --identity_file value, -i value relative path to the identity (PEM private key) file (default: ./jwt_private_key.pem)
182
+ --port value, -p value port to serve from (default: 80)
183
+ --remote value, -r value remote address (host[:port]) (default: localhost:8080)
184
+ ```
185
+
155
186
  ### Serve
156
187
  ```shell
157
188
  $ jwt help serve
Binary file
Binary file
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": "v0.7.0",
3
+ "version": "v0.8.0",
4
4
  "description": "jwt-cli is a little command line tool to create jwts locally",
5
5
  "bin": {
6
6
  "jwt": "bin/jwt"