-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic authentication support (#304)
- Loading branch information
Showing
9 changed files
with
150 additions
and
13 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
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 |
---|---|---|
@@ -1,20 +1,72 @@ | ||
## Authentication | ||
|
||
### Login | ||
OpenTMI provides multiple authentication strategies: | ||
* github OAuth | ||
* jwt | ||
* Local username/password | ||
* basic authentication | ||
|
||
To get JWT authorization token you have to use some of above login methods: | ||
|
||
|
||
### Login using username and password | ||
``` | ||
POST /auth/login | ||
body: {username: <username>, password: <password>} | ||
response: {token: <token>} | ||
``` | ||
|
||
### Login using github OAuth | ||
|
||
``` | ||
POST /auth/github | ||
GET /auth/github/id get github client id | ||
``` | ||
|
||
|
||
### Basic authentication | ||
|
||
Client can include username and password to http request like: | ||
``` | ||
curl https://admin:admin@localhost:3000/api/v0/events | ||
``` | ||
|
||
**NOTE:** Do not use this when plain HTTP is in use! | ||
|
||
### Signup new user | ||
|
||
This is not needed when user login using github authentication. | ||
|
||
``` | ||
POST /auth/signup | ||
``` | ||
|
||
|
||
### Get authenticated user information | ||
|
||
``` | ||
GET /auth/me | ||
{ groups: [], | ||
apikeys: [], | ||
_id: '<string>', | ||
name: '<string>', | ||
email: '<string>', | ||
registered: '<iso-date>', | ||
lastVisited: '<iso-date>' | ||
} | ||
``` | ||
|
||
### Update user information | ||
|
||
TBD | ||
``` | ||
PUT /auth/me | ||
POST /auth/signup | ||
``` | ||
|
||
### Log out | ||
|
||
``` | ||
POST /auth/logout | ||
POST /auth/google | ||
POST /auth/github | ||
GET /auth/github/id get github client id | ||
``` | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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