@@ -15,7 +15,8 @@ For details about the various API endpoints, see
15
15
must be provided as an ` x-api-key ` header in the HTTP request.
16
16
- We create a new API Key and email it to that email address.
17
17
* NOTE: At the moment, we do not actually send that email, since our use case
18
- is so limited that we can simply look up the API Key in the database.
18
+ is so limited that we can simply look up the API Key in the database. For
19
+ local development, run ` make list-dev-api-keys ` to see it.
19
20
- The consumer does a ` POST ` to ` /api-key/activate ` , providing the email address
20
21
and the API Key.
21
22
- We respond with an API Secret (which is actually an AES key, which we will use
@@ -261,6 +262,73 @@ gulp restore \
261
262
```
262
263
(Note: The restore time is a JavaScript timestamp, in milliseconds.)
263
264
265
+ ## Running locally
266
+
267
+ To run this locally (such as for development)...
268
+
269
+ 1 . Open a terminal to ** THIS** repo's root folder and run the following:
270
+ - ` make dynamodb-tables `
271
+ * NOTE: You may need to run this twice. If it gives an error message,
272
+ trying again should work. I think it's a timing issue, where it tries to
273
+ create the dynamodb tables before the local dynamodb is _ actually_ up
274
+ enough to be ready for interaction.
275
+ - ` make dev-server `
276
+ 2 . Add and activate api-key entry for yourself in your local serverless-mfa-api:
277
+ - Submit a ` POST ` to < https://localhost:8080/prod/api-key > with a JSON body
278
+ like the following:
279
+ ``` json
280
+
281
+ ```
282
+ It should return a `204 No Content` response.
283
+ - Run `make list-dev-api-keys`, and copy the "value" parameter's value.
284
+ - Do a `POST` to <https://localhost:8080/prod/api-key/activate>, with a JSON
285
+ body like the following:
286
+ ```json
287
+ {
288
+
289
+ "apiKey" : " the-value-parameter-from-the-dynamo-db-table"
290
+ }
291
+ ```
292
+ It should return a `200 OK` with a JSON body containing an apiSecret that
293
+ you will need. When copying that value, make sure you include any trailing
294
+ equals signs (`=`).
295
+ 3 . Clone the <https://github.com/silinternational/idp-in-a-box> repo.
296
+ 4 . Put the apiSecret returned (including any trailing `=` signs) and the apiKey
297
+ value you used in the JSON body into your local idp-in-a-box code's
298
+ `/docker-compose/broker/local.env` file, both for the `MFA_TOTP_*` and
299
+ `MFA_U2F_*` environment variables, something like this (but using **YOUR**
300
+ values for the apiKey and apiSecret entries, not these dummy/sample values):
301
+ ```
302
+ MFA_TOTP_apiBaseUrl=http://localhost:8080/
303
+ MFA_TOTP_apiKey=347a15dc60f014bdd93e4fc59aab607b022c8e19
304
+ MFA_TOTP_apiSecret=za3c5Op8XgQcWNK16Rg6Th3ndmJ2ZTGL4uEldAJxDes=
305
+
306
+ MFA_U2F_apiBaseUrl=http://localhost:8080/
307
+ MFA_U2F_apiKey=347a15dc60f014bdd93e4fc59aab607b022c8e19
308
+ MFA_U2F_apiSecret=za3c5Op8XgQcWNK16Rg6Th3ndmJ2ZTGL4uEldAJxDes=
309
+ ```
310
+ 5. Bring up the `idp-in-a-box` repo. See that repo's README.md for instructions.
311
+
312
+ ## Serverless
313
+
314
+ To start a local container for development of Serverless configuration:
315
+
316
+ ```
317
+ docker-compose run --rm dev bash
318
+ ```
319
+
320
+ ## Credential Rotation
321
+
322
+ ### AWS Serverless User
323
+
324
+ 1. Use the Terraform CLI to taint the old access key
325
+ ```
326
+ terraform taint module.serverless-user.aws_iam_access_key.serverless
327
+ ```
328
+ 2. Run a new plan on Terraform Cloud
329
+ 3. Review the new plan and apply if it is correct
330
+ 4. Copy the new key and secret from the Terraform output into Codeship
331
+
264
332
## Glossary
265
333
266
334
- `API Key`: A hex string used to identify calls to most of the endpoints on
0 commit comments