Skip to content

Commit e9ad3c9

Browse files
authored
Update README.md
1 parent c1e775c commit e9ad3c9

File tree

1 file changed

+84
-16
lines changed

1 file changed

+84
-16
lines changed

README.md

Lines changed: 84 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ An open-source user authentication module for applications built with Python and
1313
- **IP Blacklisting**: Blocks requests from specific IPs to enhance security.
1414
- **Refresh Token Rotation**: Provides secure, rotating access and refresh tokens for session management.
1515

16-
17-
1816
## Table of Contents
1917
1. [Installation](#installation)
18+
- [Redis Setup](#redis-setup)
2019
2. [Configuration](#configuration)
2120
3. [Usage](#usage)
21+
- [Postman Collection](#postman-collection)
22+
- [Check Rate Limit and Account Lockout](#check-rate-limit-and-account-lockout)
2223
4. [Project Structure](#project-structure)
23-
5. [Testing](#testing)
24+
5. [Testing](#testing) <!-- Placeholder section -->
2425
6. [Contributing](#contributing)
2526
7. [License](#license)
2627

@@ -63,7 +64,7 @@ To install Redis, follow the instructions for your operating system:
6364
```
6465

6566
- **Windows**:
66-
1. Download the latest <a href="https://github.com/microsoftarchive/redis/releases" target="_blank">Redis release for Windows</a>.
67+
1. Download the latest [Redis release for Windows](https://github.com/microsoftarchive/redis/releases).
6768
2. Extract the downloaded file, then open the extracted folder in Command Prompt.
6869
3. Run Redis with the following command:
6970
```bash
@@ -118,18 +119,6 @@ JWT_SECRET=355fa9f6f9c491417c53b701b26dd97df5825d4abd02957ce3bb1b9658593d9a
118119
SECRET_KEY=9a35f82513e1cdf2748afbd4681ff2eda8fc29a46df52cc8c4cdd561c0632400
119120
```
120121

121-
**Sample `.env.lockout` File**:
122-
By using the value below, lockout will apply after the operation reach
123-
- Device: 5 failed in 3 minutes will lockout for 30 minutes
124-
- IP Address: 15 failed in 3 minutes will lockout for 3 hours
125-
```ini
126-
OPERATION_COOLDOWN_PERIOD=180
127-
OPERATION_DEVICE_FAIL_LIMIT=5
128-
OPERATION_DEVICE_LOCKOUT_PERIOD=1800
129-
OPERATION_IP_FAIL_LIMIT=15
130-
OPERATION_IP_LOCKOUT_PERIOD=10800
131-
```
132-
133122
**Sample `.env.ratelimiting` File**:
134123
By using the value below, rate limit will apply after the operation reach
135124
- Device: 4 requests in 30 seconds will cooldown for 5 minutes
@@ -142,6 +131,18 @@ OPERATION_IP_RATE_LIMIT=10
142131
OPERATION_IP_COOLDOWN=600
143132
```
144133

134+
**Sample `.env.lockout` File**:
135+
By using the value below, lockout will apply after the operation reach
136+
- Device: 5 failed in 3 minutes will lockout for 30 minutes
137+
- IP Address: 15 failed in 3 minutes will lockout for 3 hours
138+
```ini
139+
OPERATION_COOLDOWN_PERIOD=180
140+
OPERATION_DEVICE_FAIL_LIMIT=5
141+
OPERATION_DEVICE_LOCKOUT_PERIOD=1800
142+
OPERATION_IP_FAIL_LIMIT=15
143+
OPERATION_IP_LOCKOUT_PERIOD=10800
144+
```
145+
145146
## Usage
146147
This module can be tested and used via Postman. Below is example of how to interact with the user authentication API using Postman.
147148

@@ -161,10 +162,77 @@ This module can be tested and used via Postman. Below is example of how to inter
161162
}
162163
```
163164

165+
### Postman Collection
166+
167+
To make it easier, you can use the provided Postman collection that includes all the requests for this user authentication module.
164168

169+
#### Importing the Postman Collection
170+
1. Download the Postman collection file from the link below:
171+
- [Download User Authentication Postman Collection](https://github.com/VannySothea/fastapi-user-authentication/blob/main/user_authentication_VannySothea.postman_collection)
172+
173+
2. Open Postman and click on "Import" in the top left corner.
174+
175+
3. Choose the downloaded collection file and click "Open."
176+
177+
4. The collection will appear in your Postman app, ready to use.
165178

166179
### Check Rate Limit and Account Lockout
167180
For routes that implement rate limiting and lockout, you can make requests to that endpoint multiple times to test the functionality.
168181

169182
1. **Successful Login**: Make repeated requests with valid credentials to trigger rate limiting.
170183
2. **Failed Login Attempts**: Make repeated requests with invalid credentials to trigger lockout and rate limiting.
184+
185+
## Project Structure
186+
Here’s an overview of the project directory structure:
187+
188+
```plaintext
189+
fastapi-user-authentication/
190+
├── .github/ # GitHub templates and settings
191+
├── alembic/ # Database migrations
192+
├── app/ # Main application code
193+
│ ├── config/ # Configuration files (database, email, security)
194+
│ ├── jobs/ # Background tasks and schedulers
195+
│ ├── models/ # Database models
196+
│ ├── responses/ # API response schemas
197+
│ ├── routes/ # API route handlers
198+
│ ├── schemas/ # Pydantic schemas for validation
199+
│ ├── services/ # Service logic (e.g., email, security)
200+
│ ├── templates/ # Email templates
201+
│ ├── utils/ # Utility functions
202+
│ └── main.py # Entry point for starting the FastAPI application
203+
├── env/ # Environment variables
204+
├── .gitignore # Files and directories to be ignored by Git
205+
├── LICENSE # Project license
206+
├── README.md # Project documentation
207+
├── alembic.ini # Alembic configuration
208+
├── requirements.txt # Python dependencies
209+
└── user_authentication_VannySothea.postman_collection # Postman API collection
210+
```
211+
212+
## Testing
213+
214+
Testing is planned for future updates. Contributions are welcome to help us implement a comprehensive testing suite for this project!
215+
216+
If you're interested in contributing, here are some ways you can help:
217+
218+
- **Write Unit Tests**: Help us create unit tests for existing features.
219+
- **Integration Tests**: Consider writing integration tests to ensure components work together seamlessly.
220+
- **Test Documentation**: Assist in documenting the testing process and how to run tests.
221+
222+
Feel free to open an issue or submit a pull request to discuss your contributions!
223+
## Contributing
224+
Contributions are welcome! If you’d like to contribute, please follow these guidelines:
225+
226+
1. **Fork the Repository**: Make a copy of this repo on your own GitHub account.
227+
2. **Create a New Branch**: For each feature or bug fix, create a new branch:
228+
```bash
229+
git checkout -b feature/new-feature
230+
```
231+
3. **Write Clear, Detailed Commits**: Aim for concise, meaningful commit messages.
232+
4. **Create a Pull Request**: Once your code is ready, open a pull request (PR) from your branch to the `main` branch.
233+
234+
**Code of Conduct**:
235+
Please review the `CODE_OF_CONDUCT.md` file for community guidelines and best practices when contributing.
236+
237+
## License
238+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)