-
Notifications
You must be signed in to change notification settings - Fork 105
/
PostmanUtilityLibv21.postman_collection.json
194 lines (194 loc) · 7.27 KB
/
PostmanUtilityLibv21.postman_collection.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
{
"info": {
"_postman_id": "6d13a166-5931-46e6-b43b-680a0cd3ae53",
"name": "Postman Utility Lib",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Lib install",
"event": [
{
"listen": "test",
"script": {
"id": "469df052-1d9f-40da-8e22-a78c68e22111",
"exec": [
"pm.test(\"Status code should be 200\", function () {",
" pm.response.to.have.status(200)",
" pm.globals.set(\"pmlib_code\", responseBody)",
"});"
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"id": "4a1873e6-cac6-454b-b008-67abd814b0b1",
"exec": [
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://joolfe.github.io/postman-util-lib/dist/bundle.js",
"protocol": "https",
"host": [
"joolfe",
"github",
"io"
],
"path": [
"postman-util-lib",
"dist",
"bundle.js"
]
},
"description": "Load the postman-util-lib from github.io and load into postman global variable."
},
"response": []
},
{
"name": "Lib use example",
"event": [
{
"listen": "prerequest",
"script": {
"id": "cdfe509e-9bb1-44b3-8cd4-1eea957503d1",
"exec": [
"",
"// Loading the library",
"eval(pm.globals.get('pmlib_code'))",
"",
"",
"// Generate a PKCE challenge",
"const challenge = pmlib.pkceChallenge()",
"console.log('PKCE challenge: ' +JSON.stringify(challenge))",
"",
"",
"// Obtain the SHA-256 from a string",
"const sha256String = pmlib.sha256('example string')",
"console.log('\"client_secret_jwt\": ' +sha256String)",
"",
"",
"// Create a client assertion 'client_secret_jwt'",
"const clientSecretJwt = pmlib.clientAssertSecret('mySecret', 'myIss', 'myAUD')",
"console.log('\"client_secret_jwt\": ' +clientSecretJwt)",
"",
"",
"// JWK used by jwt signature",
" const jwk = {",
" \"e\": \"AQAB\",",
" \"n\": \"7-ql2BxRpd5PEKs9h6oouoLJSK1PZgElYnHtC1EvtBcJ5rsPhRLQ95SFuzMVuPzrRymTx2DAiYrFryNNGvYgGMjwjZZ6gL0FebxGooY9P_voShuzNOg22n9aayqM7U61pmfSsu_0Gm8ZFu0hZa4VT7xn_LFIZnB_BTwG9EZtIwyGdHitMcakvdgOjTTmLqzdSjqie_7IHJrLb9JFPLrYsUDGU3v7U4joKwyZWCbaBRLrhmsAxbKhfGBA-zdSAMVtKTuu4HuQ8gnEmYpdL2wZjLH1EpxZpl_dbojzKqqGqDW7inz1SE1y4A86DE4kIzVWMqltxeMpamGOyBtSKYp5Xw\",",
" \"d\": \"7yt3myJYDse5AEAFfdoW8h_xcx862NBpqWMzUSXlLV4OQ9LVXO7uHPIWAxGhJSIVloKPTKJaLoOGINtLQYZ9ZtfiXvPVOcO10q7rp5e1NbT10_MbSrH4BQgSZmUrymK92Z8Ev9dP_I4mb-GDeq75ldyXuaQuLdkV92zo7dnLcLRciQsFsBirOOICp0RjGdCgoAZMfM5WIvRJ7XYsXP2qGMEOdyeTo3MGWZIYJGSOLvh1OMsWrrqQmPPuh0qnWj5IccJsWQv8oSNPVah9K0b0Zgv5-anr6ZkR33_vr6nK7SiZNIAH48mOrGVKGEyAZGsgoyrNhSVOg39l5jFwkamHUQ\",",
" \"p\": \"_kSDQ1oCxkTAUjSfsiZ-lj_ineDSTbcfYEP1WyhnNwfUbVP33QYAGg8f36xL65JKZAo4GaZvsVytaqiOiU5u1FFh0Tm7sRU6qG-YjYM0pynsptpQgh4p9mQ0WoURmXoryzIrqq8TRQA871gql14HVavydUrd1Gz10QJkn5cqhJk\",",
" \"q\": \"8Y0at7FhEtALdBH-L-m2Y4hI9iecA-Y6FXspsiPN4ILXmdO2V1W7pJ9uj-pBt2CWdZbBptd4w3rHiECHOXDYBsn-AjRDwcPRWnhiL_TM4TSlWtyuTAcRg7b_tSWY8ptkIH9nDHYi5_VtdkIWg74Z3oFxWZYS9SKbURnzJ8AxMLc\",",
" \"dp\": \"papmC9_9psjstaLr2dsS5zpAoLT20QPbQZGFrxsoBMbpNUJcYHmkX1YzYjyUSqxKI9w0qSGz7E-B_dhM5lFgDJ3pqbSAAeTfDxeGwc0W5UN_mUbs5ZpZpNus8L16thDPr9jEcrUXTQHWsesz9OOiy8L4ekuJNPq5PrDcds67OSE\",",
" \"dq\": \"SZXf5sf9t5pzcsesdPIw4v94oqyMZc-0MCkWGbO4m0Wg4rbRXKe8gzkimGsX3AJrs6Tal7YajwqPUJ2_1CrhVKgiXo-HeLbrxzDXUJ6174F3QkfqPTUGC-cq3Qd4IahfB1tojC5NEfb9gsI9U6MNBHDQlCcY3V7OjBVostpk4d8\",",
" \"qi\": \"M76jNmuSeQHB5niL0mhtOazj1gQ_gI69yqoCDKgG9lbb1-C1uQ_bpozc9gTwvG0OZ_iqcJ_vNm_vj3d4-2_g8Njm8KTdzILLSw8v4aV-EGijyHPJtJii91SyZY39ZDT-SaWIXAL55aIF5ZfsBhmpwcXK9iCLjy1z2sIjzo023SU\",",
" \"kty\": \"RSA\",",
" \"kid\": \"259337db-7412-45da-ad86-b63c97796588\",",
" \"use\": \"sig\"",
" }",
"// Create a signed jwt (JWS)",
"const jws = pmlib.jwtSign(jwk, { aud: 'myAUD', iss: 'myIss', claim: 'my CustomClaim' })",
"console.log('Signed JWT: ' +jws)",
"",
"",
"// Create a client assertion 'private_key_jwt'",
"const privateKeyJwt = pmlib.clientAssertPrivateKey(jwk,'myIss', 'myAUD')",
"console.log('\"private_key_jwt\": ' +privateKeyJwt)",
"",
"// Use 'jsrsasign' library",
"const base64String = pmlib.rs.stob64u('My amazing string')",
"console.log('Url Base64 string: ' + base64String)",
"",
"",
"// RSAOAEP signature example",
"const pubkey = '-----BEGIN PUBLIC KEY-----\\n' +",
"'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAstXEkU/agbNkQgh6a9DV\\n' +",
"'C/WXGmNy8g+hdTOBhYUk5PfZCwTNt5SCYBLjIPhs2ZRrNuCN3PhwHRQPQOTsS6Nl\\n' +",
"'Bzw+SjPVFBhPcbMHbJWnC87Q5ID/uAuwJjcUQXUTVspwIgfRmHvuuT7w7AYnCNvz\\n' +",
"'B5TuPj2vVH8rij9BXkAHambaeGG7L10MPeUiVU6M0F/QKCJhEWAYGEt4NffSXETx\\n' +",
"'zHSl8nyXxVJfnjxVhnZyZVXTIpLwvRy04hnkAoFexh7npRtnQdsLuIHtaJsm7gFY\\n' +",
"'mxhr3Nxbh9p1pC7fHpJ+jMcxAAhA07WqYf6lOsxXHfPav1FEMX214YTsKTw68xqo\\n' +",
"'DwIDAQAB\\n' +",
"'-----END PUBLIC KEY-----\\n'",
"const fileContent = 'My file content comes here...'",
"var keyObj = pmlib.rs.KEYUTIL.getKey(pubkey)",
"const encHex = pmlib.rs.KJUR.crypto.Cipher.encrypt(fileContent, keyObj, 'RSAOAEP')",
"console.log(encHex)",
"",
"",
"",
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"id": "6f956fb0-464a-497b-93b8-a31178bc0b8d",
"exec": [
"// Verify the returned JWT ",
"const pubkey = '-----BEGIN PUBLIC KEY-----\\n' +",
"'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAstXEkU/agbNkQgh6a9DV\\n' +",
"'C/WXGmNy8g+hdTOBhYUk5PfZCwTNt5SCYBLjIPhs2ZRrNuCN3PhwHRQPQOTsS6Nl\\n' +",
"'Bzw+SjPVFBhPcbMHbJWnC87Q5ID/uAuwJjcUQXUTVspwIgfRmHvuuT7w7AYnCNvz\\n' +",
"'B5TuPj2vVH8rij9BXkAHambaeGG7L10MPeUiVU6M0F/QKCJhEWAYGEt4NffSXETx\\n' +",
"'zHSl8nyXxVJfnjxVhnZyZVXTIpLwvRy04hnkAoFexh7npRtnQdsLuIHtaJsm7gFY\\n' +",
"'mxhr3Nxbh9p1pC7fHpJ+jMcxAAhA07WqYf6lOsxXHfPav1FEMX214YTsKTw68xqo\\n' +",
"'DwIDAQAB\\n' +",
"'-----END PUBLIC KEY-----\\n'",
"const body = JSON.parse(responseBody)",
"const result = pmlib.jwtVerify(body.jwt, pubkey)",
"console.log('Descoded JWT: ' + JSON.stringify(result))"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": []
},
"url": {
"raw": "https://joolfe.github.io/postman-util-lib/dist/fakeresponse.json",
"protocol": "https",
"host": [
"joolfe",
"github",
"io"
],
"path": [
"postman-util-lib",
"dist",
"fakeresponse.json"
]
},
"description": "Some usefull example about how to use the library."
},
"response": []
}
],
"protocolProfileBehavior": {}
}