This repository has been archived by the owner on Jul 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1087 from joyent/ether/v3.2.1-fixes
v3.2.1 fixes
- Loading branch information
Showing
5 changed files
with
57 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,26 @@ including database connectivity information. | |
|
||
* `make run` | ||
|
||
## Creating Local Credentials | ||
|
||
First, you need to get a login token into the local database. We can do this by leveraging the | ||
knowledge that an encrypted password entry of `''` will match against all supplied inputs: | ||
|
||
$ psql -U conch conch --command="insert into user_account (name, password, email) values ('me', '', '[email protected]')" | ||
|
||
Now, we use this email and password to generate a login token: | ||
|
||
make run | ||
curl -i -H'Content-Type: application/json' --url http://127.0.0.1:5001/login -d '{"email":"[email protected]","password":"anything"}' | ||
|
||
You will see output like this: | ||
|
||
{"jwt_token":"eyJInR5cCI6Iwhargarbl.eyJl9pZCI6ImM1MGYwhargarbl.WV3uJEvg0bqInI9pEtl04ZZ8ECN4yQOSmehello"} | ||
|
||
Save that token somewhere, such as in an environment variable or a file, for use in future API calls. You will include it in the "Authorization" header, for example: | ||
|
||
curl -i --url https://staging.conch.joyent.us/user/me --header "Authorization: Bearer eyJInR5cCI6Iwhargarbl.eyJl9pZCI6ImM1MGYwhargarbl.WV3uJEvg0bqInI9pEtl04ZZ8ECN4yQOSmehello" | ||
|
||
## Docker | ||
|
||
### Compose | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -724,7 +724,7 @@ sub add_test_routes ($t) { | |
remotePort => ignore, | ||
headers => superhashof({}), | ||
query_params => {}, | ||
# no body! that contains the password!!! | ||
body => { email => '[email protected]', password => '--REDACTED--' }, | ||
}, | ||
res => { | ||
headers => superhashof({}), | ||
|
@@ -759,11 +759,13 @@ sub add_test_routes ($t) { | |
remotePort => ignore, | ||
headers => superhashof({}), | ||
query_params => {}, | ||
# Test::Conch::authenticate sets set_session -> true | ||
body => { email => '[email protected]', password => '--REDACTED--', set_session => JSON::PP::true }, | ||
}, | ||
res => { | ||
headers => superhashof({}), | ||
statusCode => 200, | ||
# no body! that contains the JWT!!! | ||
body => { jwt_token => '--REDACTED--' }, | ||
}, | ||
}, | ||
'dispatch line for /login success in verbose mode', | ||
|
@@ -799,7 +801,12 @@ sub add_test_routes ($t) { | |
res => { | ||
headers => superhashof({}), | ||
statusCode => 201, | ||
# no body! that contains the api token!!! | ||
body => { | ||
name => 'my api token', | ||
token => '--REDACTED--', | ||
(map +($_ => re(qr/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3,9}Z$/)), qw(created expires)), | ||
last_used => undef, | ||
}, | ||
}, | ||
}, | ||
'dispatch line for creating a token in verbose mode does not contain the token string', | ||
|
@@ -830,7 +837,7 @@ sub add_test_routes ($t) { | |
remotePort => ignore, | ||
headers => superhashof({ Authorization => '--REDACTED--' }), | ||
query_params => {}, | ||
# no body! that contains the password!!! | ||
body => { password => '--REDACTED--' }, | ||
}, | ||
res => { | ||
headers => superhashof({}), | ||
|