|
9 | 9 | {
|
10 | 10 | "name": "Get User",
|
11 | 11 | "request": {
|
| 12 | + "auth": { |
| 13 | + "type": "bearer", |
| 14 | + "bearer": [ |
| 15 | + { |
| 16 | + "key": "token", |
| 17 | + "value": "{{token}}", |
| 18 | + "type": "string" |
| 19 | + } |
| 20 | + ] |
| 21 | + }, |
12 | 22 | "method": "GET",
|
13 |
| - "header": [ |
14 |
| - { |
15 |
| - "key": "token", |
16 |
| - "value": "Bearer {{token}}", |
17 |
| - "type": "text" |
18 |
| - } |
19 |
| - ], |
| 23 | + "header": [], |
20 | 24 | "url": {
|
21 |
| - "raw": "http://localhost:8080/api/user", |
22 |
| - "protocol": "http", |
| 25 | + "raw": "{{baseurl}}/api/user", |
23 | 26 | "host": [
|
24 |
| - "localhost" |
| 27 | + "{{baseurl}}" |
25 | 28 | ],
|
26 |
| - "port": "8080", |
27 | 29 | "path": [
|
28 | 30 | "api",
|
29 | 31 | "user"
|
|
40 | 42 | "header": [],
|
41 | 43 | "body": {
|
42 | 44 | "mode": "raw",
|
43 |
| - "raw": "{\n \"refreshToken\":\"a69adff7299c749e89752b234684d76310d0e73e\"\n}\n", |
| 45 | + "raw": "{\n \"refreshToken\":{{refreshToken}}\n}\n", |
44 | 46 | "options": {
|
45 | 47 | "raw": {
|
46 | 48 | "language": "json"
|
47 | 49 | }
|
48 | 50 | }
|
49 | 51 | },
|
50 | 52 | "url": {
|
51 |
| - "raw": "http://localhost:8080/api/auth/token/refresh", |
52 |
| - "protocol": "http", |
| 53 | + "raw": "{{baseurl}}/api/auth/token/refresh", |
53 | 54 | "host": [
|
54 |
| - "localhost" |
| 55 | + "{{baseurl}}" |
55 | 56 | ],
|
56 |
| - "port": "8080", |
57 | 57 | "path": [
|
58 | 58 | "api",
|
59 | 59 | "auth",
|
|
80 | 80 | }
|
81 | 81 | },
|
82 | 82 | "url": {
|
83 |
| - "raw": "http://localhost:8080/api/auth/register", |
84 |
| - "protocol": "http", |
| 83 | + "raw": "{{baseurl}}/api/auth/register", |
85 | 84 | "host": [
|
86 |
| - "localhost" |
| 85 | + "{{baseurl}}" |
87 | 86 | ],
|
88 |
| - "port": "8080", |
89 | 87 | "path": [
|
90 | 88 | "api",
|
91 | 89 | "auth",
|
|
110 | 108 | ],
|
111 | 109 | "type": "text/javascript"
|
112 | 110 | }
|
| 111 | + }, |
| 112 | + { |
| 113 | + "listen": "prerequest", |
| 114 | + "script": { |
| 115 | + "exec": [ |
| 116 | + "const baseurl = pm.environment.get('baseurl');", |
| 117 | + "const tokenUrl = baseurl + '/api/auth/login';", |
| 118 | + "var body = {", |
| 119 | + " username : \"john.doe\",", |
| 120 | + " password : \"password_2022W\"", |
| 121 | + "};", |
| 122 | + "", |
| 123 | + "const getTokenRequest = {", |
| 124 | + " method: 'POST',", |
| 125 | + " url: tokenUrl,", |
| 126 | + " mode: 'raw',", |
| 127 | + " body: {", |
| 128 | + " mode: 'raw',", |
| 129 | + " raw: JSON.stringify(body)", |
| 130 | + " }", |
| 131 | + "};", |
| 132 | + "", |
| 133 | + "pm.sendRequest(getTokenRequest, (err, response) => {", |
| 134 | + " const jsonResponse = response.json();", |
| 135 | + " console.log(jsonResponse);", |
| 136 | + " const newAccessToken = jsonResponse.token;", |
| 137 | + " console.log(newAccessToken);", |
| 138 | + "", |
| 139 | + " pm.variables.set('token', newAccessToken);", |
| 140 | + "});" |
| 141 | + ], |
| 142 | + "type": "text/javascript" |
| 143 | + } |
113 | 144 | }
|
114 | 145 | ],
|
115 | 146 | "request": {
|
116 | 147 | "method": "POST",
|
117 | 148 | "header": [],
|
118 | 149 | "body": {
|
119 | 150 | "mode": "raw",
|
120 |
| - "raw": "{\n \"authType\":\"USER_PASS\",\n \"username\":\"john.doe\",\n \"password\":\"\"\n}\n", |
| 151 | + "raw": "{\n \"username\":\"john.doe\",\n \"password\":\"password_2022W\"\n}", |
121 | 152 | "options": {
|
122 | 153 | "raw": {
|
123 | 154 | "language": "json"
|
124 | 155 | }
|
125 | 156 | }
|
126 | 157 | },
|
127 | 158 | "url": {
|
128 |
| - "raw": "http://localhost:8080/api/auth/login", |
129 |
| - "protocol": "http", |
| 159 | + "raw": "{{baseurl}}/api/auth/login", |
130 | 160 | "host": [
|
131 |
| - "localhost" |
| 161 | + "{{baseurl}}" |
132 | 162 | ],
|
133 |
| - "port": "8080", |
134 | 163 | "path": [
|
135 | 164 | "api",
|
136 | 165 | "auth",
|
|
144 | 173 | {
|
145 | 174 | "name": "Update User",
|
146 | 175 | "request": {
|
| 176 | + "auth": { |
| 177 | + "type": "bearer", |
| 178 | + "bearer": [ |
| 179 | + { |
| 180 | + "key": "token", |
| 181 | + "value": "{{token}}", |
| 182 | + "type": "string" |
| 183 | + } |
| 184 | + ] |
| 185 | + }, |
147 | 186 | "method": "POST",
|
148 | 187 | "header": [
|
149 | 188 | {
|
150 | 189 | "key": "Authorization",
|
151 |
| - "value": "Bearer {{token}}", |
152 |
| - "type": "text" |
| 190 | + "value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsInJvbGVzIjpbIlVTRVIiXSwiZXhwIjoxNzAyNjIwNDk0fQ.nFMZCSdxW54uPYHVm3XRohJ6oyisRS0nbB-gbBN61LE", |
| 191 | + "type": "text", |
| 192 | + "disabled": true |
153 | 193 | }
|
154 | 194 | ],
|
155 | 195 | "body": {
|
156 | 196 | "mode": "raw",
|
157 |
| - "raw": "{\n \"firstName\":\"James\",\n \"lastName\":\"Opoku\",\n}", |
| 197 | + "raw": "{\n \"firstName\":\"William\"\n\n}", |
158 | 198 | "options": {
|
159 | 199 | "raw": {
|
160 | 200 | "language": "json"
|
161 | 201 | }
|
162 | 202 | }
|
163 | 203 | },
|
164 | 204 | "url": {
|
165 |
| - "raw": "http://localhost:8080/api/user/update", |
166 |
| - "protocol": "http", |
| 205 | + "raw": "{{baseurl}}/api/user/update", |
167 | 206 | "host": [
|
168 |
| - "localhost" |
| 207 | + "{{baseurl}}" |
169 | 208 | ],
|
170 |
| - "port": "8080", |
171 | 209 | "path": [
|
172 | 210 | "api",
|
173 | 211 | "user",
|
|
181 | 219 | {
|
182 | 220 | "name": "EnableTwoFactor",
|
183 | 221 | "request": {
|
| 222 | + "auth": { |
| 223 | + "type": "bearer", |
| 224 | + "bearer": [ |
| 225 | + { |
| 226 | + "key": "token", |
| 227 | + "value": "{{token}}", |
| 228 | + "type": "string" |
| 229 | + } |
| 230 | + ] |
| 231 | + }, |
184 | 232 | "method": "POST",
|
185 | 233 | "header": [
|
186 | 234 | {
|
187 | 235 | "key": "Authorization",
|
188 | 236 | "value": "Bearer {{token}}",
|
189 |
| - "type": "text" |
| 237 | + "type": "text", |
| 238 | + "disabled": true |
190 | 239 | }
|
191 | 240 | ],
|
192 | 241 | "body": {
|
|
199 | 248 | }
|
200 | 249 | },
|
201 | 250 | "url": {
|
202 |
| - "raw": "http://localhost:8080/api/user/twofactor/enable", |
203 |
| - "protocol": "http", |
| 251 | + "raw": "{{baseurl}}/api/user/twofactor/enable", |
204 | 252 | "host": [
|
205 |
| - "localhost" |
| 253 | + "{{baseurl}}" |
206 | 254 | ],
|
207 |
| - "port": "8080", |
208 | 255 | "path": [
|
209 | 256 | "api",
|
210 | 257 | "user",
|
|
231 | 278 | }
|
232 | 279 | },
|
233 | 280 | "url": {
|
234 |
| - "raw": "http://localhost:8080/api/auth/password/reset/request", |
235 |
| - "protocol": "http", |
| 281 | + "raw": "{{baseurl}}/api/auth/password/reset/request", |
236 | 282 | "host": [
|
237 |
| - "localhost" |
| 283 | + "{{baseurl}}" |
238 | 284 | ],
|
239 |
| - "port": "8080", |
240 | 285 | "path": [
|
241 | 286 | "api",
|
242 | 287 | "auth",
|
|
251 | 296 | },
|
252 | 297 | {
|
253 | 298 | "name": "Verify Two Factor",
|
| 299 | + "event": [ |
| 300 | + { |
| 301 | + "listen": "prerequest", |
| 302 | + "script": { |
| 303 | + "exec": [ |
| 304 | + "" |
| 305 | + ], |
| 306 | + "type": "text/javascript" |
| 307 | + } |
| 308 | + } |
| 309 | + ], |
254 | 310 | "request": {
|
255 | 311 | "method": "POST",
|
256 | 312 | "header": [],
|
|
264 | 320 | }
|
265 | 321 | },
|
266 | 322 | "url": {
|
267 |
| - "raw": "http://localhost:8080/api/auth/twofactor/verify", |
268 |
| - "protocol": "http", |
| 323 | + "raw": "{{baseurl}}/api/auth/twofactor/verify", |
269 | 324 | "host": [
|
270 |
| - "localhost" |
| 325 | + "{{baseurl}}" |
271 | 326 | ],
|
272 |
| - "port": "8080", |
273 | 327 | "path": [
|
274 | 328 | "api",
|
275 | 329 | "auth",
|
|
284 | 338 | {
|
285 | 339 | "name": "VerifyTOTP",
|
286 | 340 | "request": {
|
| 341 | + "auth": { |
| 342 | + "type": "bearer", |
| 343 | + "bearer": [ |
| 344 | + { |
| 345 | + "key": "token", |
| 346 | + "value": "{{token}}", |
| 347 | + "type": "string" |
| 348 | + } |
| 349 | + ] |
| 350 | + }, |
287 | 351 | "method": "POST",
|
288 | 352 | "header": [],
|
289 | 353 | "body": {
|
|
296 | 360 | }
|
297 | 361 | },
|
298 | 362 | "url": {
|
299 |
| - "raw": "http://localhost:8080/api/user/totpcode/verify", |
300 |
| - "protocol": "http", |
| 363 | + "raw": "{{baseurl}}/api/user/totpcode/verify", |
301 | 364 | "host": [
|
302 |
| - "localhost" |
| 365 | + "{{baseurl}}" |
303 | 366 | ],
|
304 |
| - "port": "8080", |
305 | 367 | "path": [
|
306 | 368 | "api",
|
307 | 369 | "user",
|
|
328 | 390 | }
|
329 | 391 | },
|
330 | 392 | "url": {
|
331 |
| - "raw": "http://localhost:8080/api/auth/passwordless/login", |
332 |
| - "protocol": "http", |
| 393 | + "raw": "{{baseurl}}/api/auth/passwordless/login", |
333 | 394 | "host": [
|
334 |
| - "localhost" |
| 395 | + "{{baseurl}}" |
335 | 396 | ],
|
336 |
| - "port": "8080", |
337 | 397 | "path": [
|
338 | 398 | "api",
|
339 | 399 | "auth",
|
|
359 | 419 | }
|
360 | 420 | },
|
361 | 421 | "url": {
|
362 |
| - "raw": "http://localhost:8080/api/auth/passwordless/complete", |
363 |
| - "protocol": "http", |
| 422 | + "raw": "{{baseurl}}/api/auth/passwordless/complete", |
364 | 423 | "host": [
|
365 |
| - "localhost" |
| 424 | + "{{baseurl}}" |
366 | 425 | ],
|
367 |
| - "port": "8080", |
368 | 426 | "path": [
|
369 | 427 | "api",
|
370 | 428 | "auth",
|
|
0 commit comments