-
Notifications
You must be signed in to change notification settings - Fork 0
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 #2 from JohnGrubba/dev
Session Management + Welcome E-Mail + SignUp E-Mail
- Loading branch information
Showing
19 changed files
with
320 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
services: | ||
api: | ||
container_name: ezauth-api | ||
build: "./src" | ||
ports: | ||
- "3250:80" | ||
environment: | ||
- DATABASE_URL=mongodb://admin:admin@db/ezauth?authSource=admin&retryWrites=true&w=majority | ||
restart: always | ||
volumes: | ||
- ./config:/src/app/config | ||
- ./src:/src/app | ||
command: | | ||
bash -c 'uvicorn api.main:app --reload --host 0.0.0.0 --port 80 --log-level info' | ||
db: | ||
image: mongo | ||
ports: | ||
- '27017:27017' | ||
restart: always | ||
environment: | ||
- MONGO_INITDB_ROOT_USERNAME=admin | ||
- MONGO_INITDB_ROOT_PASSWORD=admin | ||
- MONGO_INITDB_DATABASE=ezauth | ||
volumes: | ||
- ezauth-data:/data/db | ||
|
||
volumes: | ||
ezauth-data: |
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 |
---|---|---|
|
@@ -12,18 +12,25 @@ Make sure that all parameters are set correctly before starting the service. | |
|------------|-------------| | ||
| `signup.enable_conf_email` | **Datatype:** Boolean <br> **Default:** `false` <br> Enable or disable the confirmation E-Mail for new users. | | ||
| `signup.conf_code_expiry` | **Datatype:** Integer <br> **Default:** `5` <br> The time in minutes until the confirmation code expires. | | ||
| `signup.conf_code_complexity` | **Datatype:** Integer <br> **Default:** `1` <br> The complexity of the confirmation code. <br> **Possible Values** <br> <ul><li>**1**: `4 Digit Numeric`</li><li>**2**: `6 Digit Numeric`</li><li>**3**: `4 Characters`</li><li>**4**: `6 Characters`</li></ul> | | ||
| `signup.enable_welcome_email` | **Datatype:** Boolean <br> **Default:** `false` <br> Enable or disable the welcome E-Mail for new users. | | ||
|
||
### Email Configuration | ||
|
||
### E-Mail Configuration | ||
|
||
??? Warning "SMTP SSL required" | ||
EZAuth uses SMTP_SSL to send E-Mails. Make sure that your SMTP server supports SSL. | ||
Currently EZAuth does not support STARTTLS. | ||
|
||
| Parameter | Description | | ||
|------------|-------------| | ||
| `email.login_usr` | **Datatype:** String <br> **Default:** `""` <br> E-Mail Login Identifier (mostly the email itself). <br> **Example:** [email protected] | | ||
| `email.login_usr` | **Datatype:** String <br> **Default:** `""` <br> E-Mail Login Identifier (mostly the E-Mail itself). <br> **Example:** [email protected] | | ||
| `email.login_pwd` | **Datatype:** String <br> **Default:** `""` <br> E-Mail Login Password. | | ||
| `email.sender_email` | **Datatype:** String <br> **Default:** `""` <br> E-Mail address from which the emails are sent (mostly the same as `email.login_usr`) | | ||
| `email.sender_email` | **Datatype:** String <br> **Default:** `""` <br> E-Mail address from which the E-Mails are sent (mostly the same as `email.login_usr`) | | ||
| `email.smtp_host` | **Datatype:** String <br> **Default:** `""` <br> SMTP Host for the E-Mail server. <br> **Example:** `smtp.gmail.com` | | ||
| `email.smtp_port` | **Datatype:** Integer <br> **Default:** `465` <br> SMTP Port for the E-Mail server. | | ||
| `email.smtp_port` | **Datatype:** Integer <br> **Default:** `465` <br> SMTP Port for the E-Mail server. | | ||
|
||
### Session Configuration | ||
| Parameter | Description | | ||
|------------|-------------| | ||
| `session.session_expiry_seconds` | **Datatype:** Integer <br> **Default:** `86400` <br> The time in seconds until a login session expires. | |
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Information about EZAuth | ||
|
||
EZAuth is a simple and easy-to-use authentication service for your applications. It is built on top of [FastAPI](https://fastapi.tiangolo.com/) | ||
and [MongoDB](https://www.mongodb.com/). | ||
|
||
## Security | ||
To guarantee the security of your user data, EZAuth uses the following security measures: | ||
|
||
- **Password Hashing**: All passwords are hashed using the `bcrypt` algorithm. | ||
- **Session Management**: Sessions can be configured to expire after a certain amount of time. | ||
- **E-Mail Verification**: Users can verify their email address before using the service. | ||
- **2FA**: Two-factor authentication can be enabled for users. | ||
- **OAuth2**: OAuth2 can be enabled for users. | ||
|
||
## Usage | ||
|
||
!!! Info "Official Libraries" | ||
We are working on official Libraries for different languages. Until then, you can use the REST API to interact with the service. | ||
Every help is appreciated. | ||
|
||
|
||
You can use EZAuth in any Application. | ||
Here are some examples in different languages: | ||
|
||
### Python | ||
```py linenums="1" | ||
import requests | ||
|
||
url = "http://localhost:3250/signup/" | ||
|
||
payload = { | ||
"email": "[email protected]", | ||
"username": "Hans", | ||
"password": "Kennwort1!", | ||
} | ||
|
||
requests.post(url, json=payload) | ||
``` | ||
|
||
### JavaScript | ||
```js linenums="1" | ||
fetch("http://localhost:3250/signup/", { | ||
method: 'POST', | ||
headers: { | ||
"Content-Type", "application/json" | ||
}, | ||
body: JSON.stringify({ | ||
"email": "[email protected]", | ||
"username": "Hans", | ||
"password": "Kennwort1!" | ||
}) | ||
}) | ||
``` | ||
|
||
### cURL | ||
```bash | ||
curl -X 'POST' | ||
'http://localhost:3250/signup/' | ||
-H 'Content-Type: application/json' | ||
-d '{ | ||
"email": "[email protected]", | ||
"username": "Hans", | ||
"password": "Kennwort1!" | ||
}' | ||
``` |
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
Empty file.
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
Empty file.
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
Oops, something went wrong.