baseauth/README.md

66 lines
2.7 KiB
Markdown
Raw Permalink Normal View History

2023-08-11 20:45:35 +00:00
# BaseAuth
2023-08-12 13:35:43 +00:00
BaseAuth is a simple auth server, which is not meant to be usable in production environments.
2023-08-11 20:45:35 +00:00
2023-08-12 13:33:41 +00:00
---
# API
2023-08-12 13:35:43 +00:00
The API uses HTTP and runs by default on port `8080`.
2023-08-12 13:33:41 +00:00
All requests to endpoints are `POST`.
2023-08-12 13:35:43 +00:00
The _Content-Type_ is always `application/json`, all payloads are JSON strings.
2023-08-12 13:33:41 +00:00
## endpoints
### `/register`
Registers a new account.
#### Content / Payload
| Field | Description |
|------------|-----------------------------------|
| `username` | The username of the account |
| `password` | The accounts' clear text password |
#### Responses
| Response | Description |
|----------|----------------------------------------------------------|
| 200 | User created successfully |
| 400 | Formal error in the request |
| 403 | Rejected for security reasons (sql injection protection) |
| 409 | The requested username is already in use |
| 500 | Internal server error |
2023-08-12 13:33:41 +00:00
### `/authenticate`
Authenticates using an existing account.
#### Content / Payload
2023-08-12 13:33:41 +00:00
| Field | Description |
|------------|-----------------------------------|
| `username` | The username of the account |
| `password` | The accounts' clear text password |
#### Responses
| Response | Description |
|----------|----------------------------------------------------------|
| 200 | Authenticated successfully |
| 400 | Formal error in the request |
| 401 | Authentication failure (wrong password) |
| 403 | Rejected for security reasons (sql injection production) |
| 404 | There was no account found with the specified name |
| 500 | Internal server error |
2023-08-12 13:33:41 +00:00
---
# CLI
## Arguments
2023-08-13 11:03:36 +00:00
| Argument | Description |
|-----------------------------|-----------------------------------------------------------------------------------------|
| `-D / --daemon <port>` | Starts the server in daemon mode, to await api requests on the specified port, etc. |
| `-d / --delete <user,user>` | Deletes the account(s) associated with the specified username(s). |
| `-l / --list` | Lists all registered accounts |
| `-w / --dir <path>` | Specifies the working dir that will be used. This dir contains stuff like the database. |