feat: #11 update README
This commit is contained in:
parent
55d524ea1b
commit
075ffa6e3f
43
README.md
43
README.md
@ -2,15 +2,48 @@
|
|||||||
|
|
||||||
A little web server providing JWT token for auth auser.
|
A little web server providing JWT token for auth auser.
|
||||||
|
|
||||||
**NOTE**: for now, the server is listening on port **9000**. Change it, in the src if needed.
|
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
```
|
||||||
|
|
||||||
# run the server
|
## Configuration
|
||||||
./target/release/simple-auth
|
|
||||||
|
### Store
|
||||||
|
The store represents the credentials. For now, this a `.txt` file with plain passwords. You have to create one like:
|
||||||
|
```txt
|
||||||
|
# acts as a comment (only on a start line)
|
||||||
|
<username>:<password>
|
||||||
|
```
|
||||||
|
**WARN**: the file should have a chmod to **600**.
|
||||||
|
|
||||||
|
### RSA key pair creation
|
||||||
|
The server uses **RS384** signature algorithm (asymmetric). You have to create a private key to sign the token and a public key for the validation:
|
||||||
|
```bash
|
||||||
|
openssl genrsa -out priv.pem 2048
|
||||||
|
openssl rsa -in priv.pem -outform PEM -pubout -out pub.pem
|
||||||
|
```
|
||||||
|
**WARN**: those files must be readable be the server user
|
||||||
|
|
||||||
|
### INI file
|
||||||
|
To start the server correctly, you need to create an `.ini` file as below:
|
||||||
|
```ini
|
||||||
|
[server]
|
||||||
|
url = <ip>:<port>
|
||||||
|
|
||||||
|
[store]
|
||||||
|
path = <store_path>
|
||||||
|
|
||||||
|
[jwt]
|
||||||
|
issuer = <issuer.fr>
|
||||||
|
private_key = <priv_key_path>
|
||||||
|
public_key = <pub_key_path>
|
||||||
|
expiration_time = 2 # in hours
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run
|
||||||
|
```bash
|
||||||
|
./simple-auth <ini_path>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Test
|
## Test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user