You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p><em>Python and FastAPI for User Authentication module focuses on securityand standard.</em></p>
2
+
<p><em><strong>Python and FastAPI for User Authentication, focuses on security, performance, and standard.</strong></em></p>
3
3
4
-
An open-source user authentication module for applications built with Python and FastAPI, designed to handle user registration, email verification, authentication, reset password, device detection, rate limiting, account lockout, IP blacklisting, and refresh token rotation.
4
+
An open-source Python and FastAPI project for user authentication, designed to handle user authentication system with role-based access control (RBAC), scheduled jobs, device and IP address detection, rate limiting, account lockout, IP blacklisting, refresh token rotation, uses Alembic for database migrations to ensure smooth schema updates and more. It leverages Async SQLAlchemy for asynchronous database operations, allowing for improved performance and scalability in handling multiple concurrent requests.
5
5
6
6
## Features
7
-
-**User Registration**: Allows new users to create an account and verify with 6-digit code via email verification.
8
-
-**User Authentication**: Enables users to log in securely using their credentials.
9
-
-**Password Reset**: Facilitates password recovery and verify with 6-digit code via email verification.
10
-
-**Device Limitation**: Allows users to log in on up to 5 devices per account, removing the oldest device upon exceeding the limit.
11
-
-**Rate Limiting**: Restricts repeated requests within a defined period to prevent abuse.
12
-
-**Account Lockout**: Temporarily locks user accounts after multiple failed login attempts.
13
-
-**IP Blacklisting**: Blocks requests from specific IPs to enhance security.
14
-
-**Refresh Token Rotation**: Provides secure, rotating access and refresh tokens for session management.
7
+
1.**User Registration**: Allows new users to create an account and verify with 6-digit code via email verification.
8
+
2.**User Authentication**: Enables users to log in securely using their credentials.
9
+
3.**Password Reset**: Facilitates password recovery and verify with 6-digit code via email verification.
10
+
4.**Device Limitation**: Allows users to log in on up to specific number of devices per account (e.g., 5 devices log in on 1 account), removing the oldest device upon exceeding the limit.
11
+
5.**Refresh Token Rotation**: Provides secure, rotating access and refresh tokens for session management.
12
+
6.**Role Base Acess Control (RBAC)**: Permissions and access levels within the application
13
+
7.**Rate Limiting**: Restricts repeated requests within a defined period to prevent abuse.
14
+
8.**Account Lockout**: Temporarily locks user accounts after multiple failed login attempts.
15
+
9.**IP Blacklisting**: Blocks requests from specific IPs to enhance security.
16
+
10.**Periodic Cleanup**: Schedule background jobs for tasks like cleanup. This keeps the database clean and prevents it from growing uncontrollably.
17
+
11.**Temporary Storage**: Store registration data in a temporary location (e.g., a separate database table) until the user verifies their email. Once verified, move the data to the main user table. This keeps the primary user table free from unverified accounts.
18
+
12.**Async SQLAlchemy**: for asynchronous database operations, allowing for improved performance and scalability in handling multiple concurrent requests.
-[Check Rate Limit and Account Lockout](#check-rate-limit-and-account-lockout)
23
31
4.[Project Structure](#project-structure)
@@ -76,8 +84,65 @@ To install Redis, follow the instructions for your operating system:
76
84
```
77
85
78
86
## Configuration
79
-
You can configure database, email, rate limits, lockout settings, token secret, and other settings via environment variables or by modifying the `.env` file format.
from app.jobs.scheduler import start_scheduler, shutdown_scheduler
135
+
136
+
start_scheduler()
137
+
138
+
@app.on_event("shutdown")
139
+
def shutdown_event():
140
+
shutdown_scheduler()
141
+
```
142
+
143
+
### Environment Variables
144
+
You can configure database, email, rate limits, lockout settings, token secret, and other settings via environment variables or by modifying the `.env` file format.
145
+
#### App Environment Variables
81
146
**Sample `.env` File**:
82
147
```ini
83
148
APP_NAME=APP_NAME
@@ -90,20 +155,7 @@ ACCESS_TOKEN_EXPIRE_MINUTES=3
90
155
REFRESH_TOKEN_EXPIRE_MINUTES=25920 #18 days = 25920 minutes
To manage database schema changes, this project utilizes Alembic. Ensure you have Alembic installed and configured. You can run migrations with the following command:
@@ -235,4 +311,12 @@ Contributions are welcome! If you’d like to contribute, please follow these gu
235
311
Please review the `CODE_OF_CONDUCT.md` file for community guidelines and best practices when contributing.
236
312
237
313
## License
238
-
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
314
+
`VannySothea/fastapi-user-authentication` is open source and free to use based on `MIT License` and can be used for commercial purposes for free, but please clearly display the copyright information about VannySothea/fastapi-user-authentication in the display interface.
315
+
- This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
316
+
317
+
## Thanks
318
+
Thanks to the following developers for their contributions to fastapi-user-authentication:
0 commit comments