oauth2fast-fastapi 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oauth2fast_fastapi-0.1.1/LICENSE +21 -0
- oauth2fast_fastapi-0.1.1/MANIFEST.in +8 -0
- oauth2fast_fastapi-0.1.1/PKG-INFO +390 -0
- oauth2fast_fastapi-0.1.1/README.md +324 -0
- oauth2fast_fastapi-0.1.1/docs/env.example +26 -0
- oauth2fast_fastapi-0.1.1/docs/usage.md +212 -0
- oauth2fast_fastapi-0.1.1/examples/basic_usage.py +58 -0
- oauth2fast_fastapi-0.1.1/examples/complete_flow.py +102 -0
- oauth2fast_fastapi-0.1.1/examples/custom_user.py +52 -0
- oauth2fast_fastapi-0.1.1/pyproject.toml +78 -0
- oauth2fast_fastapi-0.1.1/setup.cfg +4 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/__init__.py +21 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/__version__.py +1 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/database.py +12 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/dependencies.py +90 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/mail/__init__.py +1 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/mail/connection.py +22 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/mail/service.py +39 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/mail/templates/verification.html +231 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/mail/templates/welcome.html +12 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/models/__init__.py +1 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/models/bases.py +10 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/models/mixins.py +32 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/models/user_model.py +21 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/routers/__init__.py +0 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/routers/base_router.py +61 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/routers/users_router.py +249 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/schemas/__init__.py +0 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/schemas/mixins.py +8 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/schemas/token_schema.py +14 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/schemas/user_schema.py +17 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/schemas/verification_schema.py +20 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/settings.py +71 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/utils/__init__.py +0 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/utils/password_utils.py +33 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/utils/token_utils.py +55 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi/utils/verification_utils.py +53 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi.egg-info/PKG-INFO +390 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi.egg-info/SOURCES.txt +40 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi.egg-info/dependency_links.txt +1 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi.egg-info/requires.txt +20 -0
- oauth2fast_fastapi-0.1.1/src/oauth2fast_fastapi.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Angel Daniel Sanchez Castillo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: oauth2fast-fastapi
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Fast and secure OAuth2 authentication module for FastAPI with email verification
|
|
5
|
+
Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Angel Daniel Sanchez Castillo
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/AngelDanielSanchezCastillo/oauth2fast-fastapi
|
|
29
|
+
Project-URL: Documentation, https://github.com/AngelDanielSanchezCastillo/oauth2fast-fastapi/tree/main/docs
|
|
30
|
+
Project-URL: Repository, https://github.com/AngelDanielSanchezCastillo/oauth2fast-fastapi
|
|
31
|
+
Project-URL: Issues, https://github.com/AngelDanielSanchezCastillo/oauth2fast-fastapi/issues
|
|
32
|
+
Keywords: fastapi,oauth2,authentication,jwt,email-verification,sqlmodel
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Framework :: FastAPI
|
|
41
|
+
Classifier: Topic :: Security
|
|
42
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
43
|
+
Requires-Python: >=3.10
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
License-File: LICENSE
|
|
46
|
+
Requires-Dist: fastapi>=0.100.0
|
|
47
|
+
Requires-Dist: pydantic>=2.0.0
|
|
48
|
+
Requires-Dist: pydantic-settings>=2.0.0
|
|
49
|
+
Requires-Dist: sqlalchemy>=2.0.0
|
|
50
|
+
Requires-Dist: sqlmodel>=0.0.14
|
|
51
|
+
Requires-Dist: asyncpg>=0.29.0
|
|
52
|
+
Requires-Dist: python-jose[cryptography]>=3.3.0
|
|
53
|
+
Requires-Dist: passlib[argon2]>=1.7.4
|
|
54
|
+
Requires-Dist: argon2-cffi>=25.0.0
|
|
55
|
+
Requires-Dist: greenlet>=3.0.0
|
|
56
|
+
Requires-Dist: python-multipart>=0.0.6
|
|
57
|
+
Requires-Dist: fastapi-mail>=1.4.0
|
|
58
|
+
Requires-Dist: log2fast-fastapi>=0.1.0
|
|
59
|
+
Provides-Extra: dev
|
|
60
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
61
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
62
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
63
|
+
Requires-Dist: httpx>=0.24.0; extra == "dev"
|
|
64
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
65
|
+
Dynamic: license-file
|
|
66
|
+
|
|
67
|
+
# oauth2fast-fastapi
|
|
68
|
+
|
|
69
|
+
🔐 Fast and secure OAuth2 authentication module for FastAPI with email verification and JWT tokens
|
|
70
|
+
|
|
71
|
+
> [!WARNING]
|
|
72
|
+
> **Internal Use Notice**
|
|
73
|
+
>
|
|
74
|
+
> This package is designed and maintained by the **Solautyc Team** for internal use. While it is publicly available, it may not work as expected in all environments or use cases outside of our specific infrastructure. We do not provide support or guarantees for external usage, and we are not responsible for any issues that may arise from using this package in other contexts.
|
|
75
|
+
>
|
|
76
|
+
> Use at your own risk. Contributions and feedback are welcome, but compatibility with external environments is not guaranteed.
|
|
77
|
+
|
|
78
|
+
## Features
|
|
79
|
+
|
|
80
|
+
- 🔐 **Complete OAuth2 Implementation**: Full OAuth2 password flow with JWT tokens
|
|
81
|
+
- 📧 **Email Verification**: Built-in email verification system with customizable templates
|
|
82
|
+
- 👤 **User Management**: Ready-to-use user registration, login, and profile endpoints
|
|
83
|
+
- 🗄️ **SQLModel Integration**: Async PostgreSQL support with SQLModel/SQLAlchemy
|
|
84
|
+
- 🔑 **Secure Password Hashing**: Argon2 password hashing (winner of Password Hashing Competition)
|
|
85
|
+
- 🎯 **FastAPI Dependencies**: Easy-to-use dependencies for protected routes
|
|
86
|
+
- ⚡ **Async/Await**: Full async support for high performance
|
|
87
|
+
- 🎨 **Customizable**: Extend the User model with your own fields
|
|
88
|
+
- 📝 **Type-Safe Configuration**: Pydantic settings with environment variables
|
|
89
|
+
- 🔄 **Email Templates**: Jinja2 templates for verification and welcome emails
|
|
90
|
+
|
|
91
|
+
## Installation
|
|
92
|
+
|
|
93
|
+
### From PyPI (Recommended)
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install oauth2fast-fastapi
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### From Source
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Clone the repository
|
|
103
|
+
git clone https://github.com/AngelDanielSanchezCastillo/oauth2fast-fastapi.git
|
|
104
|
+
cd oauth2fast-fastapi
|
|
105
|
+
|
|
106
|
+
# Install in development mode
|
|
107
|
+
pip install -e .
|
|
108
|
+
|
|
109
|
+
# Or install with dev dependencies
|
|
110
|
+
pip install -e ".[dev]"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Quick Start
|
|
114
|
+
|
|
115
|
+
### 1. Configure Environment Variables
|
|
116
|
+
|
|
117
|
+
Create a `.env` file in your project root:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Required JWT Configuration
|
|
121
|
+
SECRET_KEY=your-super-secret-key-change-this-in-production
|
|
122
|
+
ALGORITHM=HS256
|
|
123
|
+
ACCESS_TOKEN_EXPIRE_MINUTES=60
|
|
124
|
+
|
|
125
|
+
# Database Configuration
|
|
126
|
+
AUTH_DB__USERNAME=postgres
|
|
127
|
+
AUTH_DB__PASSWORD=yourpassword
|
|
128
|
+
AUTH_DB__HOSTNAME=localhost
|
|
129
|
+
AUTH_DB__NAME=myapp_db
|
|
130
|
+
AUTH_DB__PORT=5432
|
|
131
|
+
|
|
132
|
+
# Mail Server Configuration
|
|
133
|
+
AUTH_MAIL_SERVER__USERNAME=noreply@yourapp.com
|
|
134
|
+
AUTH_MAIL_SERVER__PASSWORD=your-smtp-password
|
|
135
|
+
AUTH_MAIL_SERVER__SERVER=smtp.gmail.com
|
|
136
|
+
AUTH_MAIL_SERVER__PORT=587
|
|
137
|
+
AUTH_MAIL_SERVER__FROM_DIRECTION=noreply@yourapp.com
|
|
138
|
+
AUTH_MAIL_SERVER__FROM_NAME=Your App
|
|
139
|
+
AUTH_MAIL_SERVER__STARTTLS=true
|
|
140
|
+
AUTH_MAIL_SERVER__SSL_TLS=false
|
|
141
|
+
|
|
142
|
+
# Application Settings
|
|
143
|
+
PROJECT_NAME=My App
|
|
144
|
+
FRONTEND_URL=https://yourapp.com
|
|
145
|
+
AUTH_URL_PREFIX=auth
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
> [!IMPORTANT]
|
|
149
|
+
> The `SECRET_KEY` is **required** and must be set in your `.env` file. Generate a secure key:
|
|
150
|
+
> ```bash
|
|
151
|
+
> python -c "import secrets; print(secrets.token_urlsafe(32))"
|
|
152
|
+
> ```
|
|
153
|
+
|
|
154
|
+
### 2. Basic FastAPI Integration
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
from fastapi import FastAPI, Depends
|
|
158
|
+
from oauth2fast_fastapi import router, engine, get_current_user, User
|
|
159
|
+
from sqlmodel import SQLModel
|
|
160
|
+
|
|
161
|
+
app = FastAPI()
|
|
162
|
+
|
|
163
|
+
# Include authentication router
|
|
164
|
+
app.include_router(router, prefix="/auth", tags=["Authentication"])
|
|
165
|
+
|
|
166
|
+
@app.on_event("startup")
|
|
167
|
+
async def startup():
|
|
168
|
+
# Create database tables
|
|
169
|
+
async with engine.begin() as conn:
|
|
170
|
+
await conn.run_sync(SQLModel.metadata.create_all)
|
|
171
|
+
|
|
172
|
+
@app.get("/profile")
|
|
173
|
+
async def get_profile(current_user: User = Depends(get_current_user)):
|
|
174
|
+
return {
|
|
175
|
+
"email": current_user.email,
|
|
176
|
+
"name": f"{current_user.first_name} {current_user.last_name}",
|
|
177
|
+
"verified": current_user.is_verified
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 3. Authentication Flow
|
|
182
|
+
|
|
183
|
+
**Register a new user:**
|
|
184
|
+
```bash
|
|
185
|
+
POST /auth/users/register
|
|
186
|
+
{
|
|
187
|
+
"email": "user@example.com",
|
|
188
|
+
"password": "SecurePassword123",
|
|
189
|
+
"first_name": "John",
|
|
190
|
+
"last_name": "Doe"
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Verify email:**
|
|
195
|
+
```bash
|
|
196
|
+
POST /auth/users/verify-email
|
|
197
|
+
{
|
|
198
|
+
"token": "verification-token-from-email"
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Login:**
|
|
203
|
+
```bash
|
|
204
|
+
POST /auth/token
|
|
205
|
+
Content-Type: application/x-www-form-urlencoded
|
|
206
|
+
|
|
207
|
+
username=user@example.com&password=SecurePassword123
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Response:
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
|
214
|
+
"token_type": "bearer"
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Access protected endpoint:**
|
|
219
|
+
```bash
|
|
220
|
+
GET /profile
|
|
221
|
+
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Protected Endpoints
|
|
225
|
+
|
|
226
|
+
Use the provided dependencies to protect your endpoints:
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
from fastapi import Depends
|
|
230
|
+
from oauth2fast_fastapi import get_current_user, get_current_verified_user, User
|
|
231
|
+
|
|
232
|
+
# Requires authentication only
|
|
233
|
+
@app.get("/dashboard")
|
|
234
|
+
async def dashboard(user: User = Depends(get_current_user)):
|
|
235
|
+
return {"message": f"Welcome {user.email}"}
|
|
236
|
+
|
|
237
|
+
# Requires authentication AND email verification
|
|
238
|
+
@app.get("/premium")
|
|
239
|
+
async def premium_feature(user: User = Depends(get_current_verified_user)):
|
|
240
|
+
return {"message": "Access granted to verified users only"}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Custom User Model
|
|
244
|
+
|
|
245
|
+
Extend the base User model with your own fields:
|
|
246
|
+
|
|
247
|
+
```python
|
|
248
|
+
from oauth2fast_fastapi.models.user_model import User as BaseUser
|
|
249
|
+
from sqlmodel import Field
|
|
250
|
+
|
|
251
|
+
class CustomUser(BaseUser, table=True):
|
|
252
|
+
__tablename__ = "custom_users"
|
|
253
|
+
|
|
254
|
+
phone_number: str | None = Field(default=None)
|
|
255
|
+
company: str | None = Field(default=None)
|
|
256
|
+
role: str = Field(default="user")
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Available Endpoints
|
|
260
|
+
|
|
261
|
+
The authentication router provides the following endpoints:
|
|
262
|
+
|
|
263
|
+
- `POST /auth/users/register` - Register a new user
|
|
264
|
+
- `POST /auth/users/verify-email` - Verify email with token
|
|
265
|
+
- `POST /auth/users/resend-verification` - Resend verification email
|
|
266
|
+
- `POST /auth/token` - Login and get JWT token
|
|
267
|
+
- `GET /auth/users/me` - Get current user profile
|
|
268
|
+
- `PUT /auth/users/me` - Update current user profile
|
|
269
|
+
|
|
270
|
+
## Configuration Reference
|
|
271
|
+
|
|
272
|
+
All configuration is done via environment variables with nested delimiter `__`.
|
|
273
|
+
|
|
274
|
+
### JWT Settings (Required)
|
|
275
|
+
- `SECRET_KEY` - **Required**: Secret key for JWT signing
|
|
276
|
+
- `ALGORITHM` - Default: `"HS256"`: JWT algorithm
|
|
277
|
+
- `ACCESS_TOKEN_EXPIRE_MINUTES` - Default: `60`: Token expiration time in minutes
|
|
278
|
+
|
|
279
|
+
### Database Settings
|
|
280
|
+
- `AUTH_DB__USERNAME` - Database username
|
|
281
|
+
- `AUTH_DB__PASSWORD` - Database password
|
|
282
|
+
- `AUTH_DB__HOSTNAME` - Database host
|
|
283
|
+
- `AUTH_DB__NAME` - Database name
|
|
284
|
+
- `AUTH_DB__PORT` - Database port (default: 5432)
|
|
285
|
+
|
|
286
|
+
### Mail Settings
|
|
287
|
+
- `AUTH_MAIL_SERVER__USERNAME` - SMTP username
|
|
288
|
+
- `AUTH_MAIL_SERVER__PASSWORD` - SMTP password
|
|
289
|
+
- `AUTH_MAIL_SERVER__SERVER` - SMTP server
|
|
290
|
+
- `AUTH_MAIL_SERVER__PORT` - SMTP port
|
|
291
|
+
- `AUTH_MAIL_SERVER__FROM_DIRECTION` - From email address
|
|
292
|
+
- `AUTH_MAIL_SERVER__FROM_NAME` - From name
|
|
293
|
+
- `AUTH_MAIL_SERVER__STARTTLS` - Use STARTTLS (default: false)
|
|
294
|
+
- `AUTH_MAIL_SERVER__SSL_TLS` - Use SSL/TLS (default: true)
|
|
295
|
+
|
|
296
|
+
### Application Settings
|
|
297
|
+
- `PROJECT_NAME` - Application name (used in emails)
|
|
298
|
+
- `FRONTEND_URL` - Frontend URL (for email links)
|
|
299
|
+
- `AUTH_URL_PREFIX` - Auth router prefix (default: "auth")
|
|
300
|
+
|
|
301
|
+
## 📚 Documentation
|
|
302
|
+
|
|
303
|
+
- **[Usage Guide](docs/usage.md)** - Comprehensive usage guide with examples
|
|
304
|
+
- **[Environment Configuration](docs/env.example)** - All configuration options
|
|
305
|
+
|
|
306
|
+
## 📁 Module Structure
|
|
307
|
+
|
|
308
|
+
```
|
|
309
|
+
oauth2fast-fastapi/
|
|
310
|
+
├── pyproject.toml
|
|
311
|
+
├── MANIFEST.in
|
|
312
|
+
├── README.md
|
|
313
|
+
├── LICENSE
|
|
314
|
+
├── src/
|
|
315
|
+
│ └── oauth2fast_fastapi/
|
|
316
|
+
│ ├── __init__.py
|
|
317
|
+
│ ├── __version__.py
|
|
318
|
+
│ ├── settings.py # Pydantic settings
|
|
319
|
+
│ ├── database.py # Database engine
|
|
320
|
+
│ ├── dependencies.py # FastAPI dependencies
|
|
321
|
+
│ ├── models/
|
|
322
|
+
│ │ ├── bases.py # Base models
|
|
323
|
+
│ │ ├── mixins.py # Model mixins
|
|
324
|
+
│ │ └── user_model.py # User model
|
|
325
|
+
│ ├── routers/
|
|
326
|
+
│ │ ├── base_router.py # Main router
|
|
327
|
+
│ │ └── users_router.py # User endpoints
|
|
328
|
+
│ ├── schemas/
|
|
329
|
+
│ │ ├── token_schema.py # JWT schemas
|
|
330
|
+
│ │ ├── user_schema.py # User schemas
|
|
331
|
+
│ │ └── verification_schema.py
|
|
332
|
+
│ ├── utils/
|
|
333
|
+
│ │ ├── password_utils.py # Password hashing
|
|
334
|
+
│ │ ├── token_utils.py # JWT utilities
|
|
335
|
+
│ │ └── verification_utils.py
|
|
336
|
+
│ └── mail/
|
|
337
|
+
│ ├── connection.py # SMTP connection
|
|
338
|
+
│ ├── service.py # Email service
|
|
339
|
+
│ └── templates/ # Email templates
|
|
340
|
+
│ ├── verification.html
|
|
341
|
+
│ └── welcome.html
|
|
342
|
+
├── docs/
|
|
343
|
+
│ ├── env.example
|
|
344
|
+
│ └── usage.md
|
|
345
|
+
├── examples/
|
|
346
|
+
│ ├── basic_usage.py
|
|
347
|
+
│ ├── custom_user.py
|
|
348
|
+
│ └── complete_flow.py
|
|
349
|
+
└── tests/
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Dependencies
|
|
353
|
+
|
|
354
|
+
This module depends on:
|
|
355
|
+
|
|
356
|
+
- [FastAPI](https://github.com/tiangolo/fastapi) - Modern web framework (MIT License)
|
|
357
|
+
- [Pydantic](https://github.com/pydantic/pydantic) - Data validation (MIT License)
|
|
358
|
+
- [SQLModel](https://github.com/tiangolo/sqlmodel) - SQL databases with Python (MIT License)
|
|
359
|
+
- [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy) - Database toolkit (MIT License)
|
|
360
|
+
- [asyncpg](https://github.com/MagicStack/asyncpg) - PostgreSQL driver (Apache 2.0)
|
|
361
|
+
- [python-jose](https://github.com/mpdavis/python-jose) - JWT implementation (MIT License)
|
|
362
|
+
- [passlib](https://github.com/glic3rinu/passlib) - Password hashing (BSD License)
|
|
363
|
+
- [fastapi-mail](https://github.com/sabuhish/fastapi-mail) - Email sending (MIT License)
|
|
364
|
+
- [log2fast-fastapi](https://github.com/AngelDanielSanchezCastillo/log2fast-fastapi) - Logging module (MIT License)
|
|
365
|
+
|
|
366
|
+
We are grateful to the maintainers and contributors of these projects.
|
|
367
|
+
|
|
368
|
+
## Security Features
|
|
369
|
+
|
|
370
|
+
- 🔒 **Argon2 Password Hashing**: Uses Argon2, the winner of the Password Hashing Competition
|
|
371
|
+
- 🎫 **JWT Tokens**: Secure token-based authentication
|
|
372
|
+
- ✉️ **Email Verification**: Prevents fake account creation
|
|
373
|
+
- 🔐 **Secure Defaults**: Sensible security defaults out of the box
|
|
374
|
+
- 🛡️ **SQL Injection Protection**: SQLModel/SQLAlchemy ORM prevents SQL injection
|
|
375
|
+
|
|
376
|
+
## License
|
|
377
|
+
|
|
378
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
379
|
+
|
|
380
|
+
Copyright (c) 2026 Angel Daniel Sanchez Castillo
|
|
381
|
+
|
|
382
|
+
**Note**: This package is designed and maintained by the Solautyc Team for internal use. While publicly available under MIT license, use at your own risk.
|
|
383
|
+
|
|
384
|
+
## Contributing
|
|
385
|
+
|
|
386
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
387
|
+
|
|
388
|
+
## Support
|
|
389
|
+
|
|
390
|
+
For issues and questions, please use the [GitHub Issues](https://github.com/AngelDanielSanchezCastillo/oauth2fast-fastapi/issues) page.
|