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