Auth with global secret for admin endpoints

This commit is contained in:
simon987
2019-03-09 13:05:31 -05:00
parent e2ba51b77a
commit b095c92cfd
5 changed files with 118 additions and 14 deletions

View File

@@ -7,9 +7,32 @@
| `WS_BUCKET_LOGLEVEL` | `trace` |
| `WS_BUCKET_CONNSTR` | `host=localhost user=ws_bucket dbname=ws_bucket password=ws_bucket sslmode=disable` |
| `WS_BUCKET_DIALECT` | `postgres` |
| `WS_BUCKET_SECRET` | `default_secret`* |
\* You should change this value!
### Running tests
```bash
export WS_BUCKET_ADDR=0.0.0.0:3021
export WS_BUCKET_WORKDIR=.
cd test/
go test
```
```
### Auth
Administration endpoints require HMAC_SHA256 authentication.
Request header:
```
{
"Timestamp": <Current time (RFC1123)>
"X-Signature": <HMAC_SHA256(BODY + TIMESTAMP)>
}
```
Upload endpoint requires a valid upload token:
```
{
"X-Upload-Token": <token>
}
```