oauth2fast-fastapi 0.2.3__tar.gz → 0.2.4__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.
Files changed (44) hide show
  1. {oauth2fast_fastapi-0.2.3/src/oauth2fast_fastapi.egg-info → oauth2fast_fastapi-0.2.4}/PKG-INFO +17 -14
  2. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/README.md +16 -13
  3. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/examples/basic_usage.py +2 -3
  4. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/examples/complete_flow.py +2 -2
  5. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/examples/custom_user.py +3 -3
  6. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/pyproject.toml +1 -1
  7. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/__init__.py +2 -1
  8. oauth2fast_fastapi-0.2.4/src/oauth2fast_fastapi/__version__.py +1 -0
  9. oauth2fast_fastapi-0.2.4/src/oauth2fast_fastapi/models/__init__.py +2 -0
  10. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/models/mixins.py +11 -13
  11. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4/src/oauth2fast_fastapi.egg-info}/PKG-INFO +17 -14
  12. oauth2fast_fastapi-0.2.3/src/oauth2fast_fastapi/__version__.py +0 -1
  13. oauth2fast_fastapi-0.2.3/src/oauth2fast_fastapi/models/__init__.py +0 -1
  14. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/LICENSE +0 -0
  15. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/MANIFEST.in +0 -0
  16. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/docs/env.example +0 -0
  17. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/docs/usage.md +0 -0
  18. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/setup.cfg +0 -0
  19. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/database.py +0 -0
  20. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/dependencies.py +0 -0
  21. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/mail/__init__.py +0 -0
  22. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/mail/service.py +0 -0
  23. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/mail/templates/verification.html +0 -0
  24. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/mail/templates/welcome.html +0 -0
  25. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/models/bases.py +0 -0
  26. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/models/user_model.py +0 -0
  27. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/routers/__init__.py +0 -0
  28. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/routers/base_router.py +0 -0
  29. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/routers/users_router.py +0 -0
  30. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/schemas/__init__.py +0 -0
  31. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/schemas/mixins.py +0 -0
  32. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/schemas/token_schema.py +0 -0
  33. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/schemas/user_schema.py +0 -0
  34. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/schemas/verification_schema.py +0 -0
  35. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/settings.py +0 -0
  36. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/utils/__init__.py +0 -0
  37. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/utils/password_utils.py +0 -0
  38. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/utils/token_utils.py +0 -0
  39. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi/utils/verification_utils.py +0 -0
  40. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi.egg-info/SOURCES.txt +0 -0
  41. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi.egg-info/dependency_links.txt +0 -0
  42. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi.egg-info/requires.txt +0 -0
  43. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/src/oauth2fast_fastapi.egg-info/top_level.txt +0 -0
  44. {oauth2fast_fastapi-0.2.3 → oauth2fast_fastapi-0.2.4}/tests/test_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oauth2fast-fastapi
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Fast and secure OAuth2 authentication module for FastAPI with email verification
5
5
  Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
6
6
  License: MIT License
@@ -112,21 +112,24 @@ ALGORITHM=HS256
112
112
  ACCESS_TOKEN_EXPIRE_MINUTES=60
113
113
 
114
114
  # Database Configuration
115
- AUTH_DB__USERNAME=postgres
116
- AUTH_DB__PASSWORD=yourpassword
117
- AUTH_DB__HOSTNAME=localhost
118
- AUTH_DB__NAME=myapp_db
119
- AUTH_DB__PORT=5432
115
+ DB_DEFAULT_CONNECTION=auth
116
+ DB_CONNECTIONS__AUTH__HOST=localhost
117
+ DB_CONNECTIONS__AUTH__PORT=5432
118
+ DB_CONNECTIONS__AUTH__USERNAME=postgres
119
+ DB_CONNECTIONS__AUTH__PASSWORD=yourpassword
120
+ DB_CONNECTIONS__AUTH__DATABASE=myapp_db
120
121
 
121
122
  # Mail Server Configuration
122
- AUTH_MAIL_SERVER__USERNAME=noreply@yourapp.com
123
- AUTH_MAIL_SERVER__PASSWORD=your-smtp-password
124
- AUTH_MAIL_SERVER__SERVER=smtp.gmail.com
125
- AUTH_MAIL_SERVER__PORT=587
126
- AUTH_MAIL_SERVER__FROM_DIRECTION=noreply@yourapp.com
127
- AUTH_MAIL_SERVER__FROM_NAME=Your App
128
- AUTH_MAIL_SERVER__STARTTLS=true
129
- AUTH_MAIL_SERVER__SSL_TLS=false
123
+ MAIL_DEFAULT_ACCOUNT=auth
124
+ MAIL_SMTP_ACCOUNTS__AUTH__HOST=smtp.gmail.com
125
+ MAIL_SMTP_ACCOUNTS__AUTH__PORT=587
126
+ MAIL_SMTP_ACCOUNTS__AUTH__USERNAME="noreply@yourapp.com"
127
+ MAIL_SMTP_ACCOUNTS__AUTH__PASSWORD="your-smtp-password"
128
+ MAIL_SMTP_ACCOUNTS__AUTH__SECURITY=tls
129
+ MAIL_SMTP_ACCOUNTS__AUTH__FROM_EMAIL="noreply@yourapp.com"
130
+ MAIL_SMTP_ACCOUNTS__AUTH__FROM_NAME="Your pp"
131
+ MAIL_SMTP_ACCOUNTS__AUTH__REPLY_TO="reply@yourapp.com"
132
+ MAIL_SMTP_ACCOUNTS__AUTH__TIMEOUT=60
130
133
 
131
134
  # Application Settings
132
135
  PROJECT_NAME=My App
@@ -57,21 +57,24 @@ ALGORITHM=HS256
57
57
  ACCESS_TOKEN_EXPIRE_MINUTES=60
58
58
 
59
59
  # Database Configuration
60
- AUTH_DB__USERNAME=postgres
61
- AUTH_DB__PASSWORD=yourpassword
62
- AUTH_DB__HOSTNAME=localhost
63
- AUTH_DB__NAME=myapp_db
64
- AUTH_DB__PORT=5432
60
+ DB_DEFAULT_CONNECTION=auth
61
+ DB_CONNECTIONS__AUTH__HOST=localhost
62
+ DB_CONNECTIONS__AUTH__PORT=5432
63
+ DB_CONNECTIONS__AUTH__USERNAME=postgres
64
+ DB_CONNECTIONS__AUTH__PASSWORD=yourpassword
65
+ DB_CONNECTIONS__AUTH__DATABASE=myapp_db
65
66
 
66
67
  # Mail Server Configuration
67
- AUTH_MAIL_SERVER__USERNAME=noreply@yourapp.com
68
- AUTH_MAIL_SERVER__PASSWORD=your-smtp-password
69
- AUTH_MAIL_SERVER__SERVER=smtp.gmail.com
70
- AUTH_MAIL_SERVER__PORT=587
71
- AUTH_MAIL_SERVER__FROM_DIRECTION=noreply@yourapp.com
72
- AUTH_MAIL_SERVER__FROM_NAME=Your App
73
- AUTH_MAIL_SERVER__STARTTLS=true
74
- AUTH_MAIL_SERVER__SSL_TLS=false
68
+ MAIL_DEFAULT_ACCOUNT=auth
69
+ MAIL_SMTP_ACCOUNTS__AUTH__HOST=smtp.gmail.com
70
+ MAIL_SMTP_ACCOUNTS__AUTH__PORT=587
71
+ MAIL_SMTP_ACCOUNTS__AUTH__USERNAME="noreply@yourapp.com"
72
+ MAIL_SMTP_ACCOUNTS__AUTH__PASSWORD="your-smtp-password"
73
+ MAIL_SMTP_ACCOUNTS__AUTH__SECURITY=tls
74
+ MAIL_SMTP_ACCOUNTS__AUTH__FROM_EMAIL="noreply@yourapp.com"
75
+ MAIL_SMTP_ACCOUNTS__AUTH__FROM_NAME="Your pp"
76
+ MAIL_SMTP_ACCOUNTS__AUTH__REPLY_TO="reply@yourapp.com"
77
+ MAIL_SMTP_ACCOUNTS__AUTH__TIMEOUT=60
75
78
 
76
79
  # Application Settings
77
80
  PROJECT_NAME=My App
@@ -5,8 +5,7 @@ This example shows how to integrate oauth2fast-fastapi into a FastAPI applicatio
5
5
  """
6
6
 
7
7
  from fastapi import Depends, FastAPI
8
- from oauth2fast_fastapi import User, engine, get_current_user, router
9
- from sqlmodel import SQLModel
8
+ from oauth2fast_fastapi import User, engine, get_current_user, router, AuthModel
10
9
 
11
10
  app = FastAPI(
12
11
  title="OAuth2Fast Example",
@@ -21,7 +20,7 @@ app.include_router(router, prefix="/auth", tags=["Authentication"])
21
20
  async def startup():
22
21
  """Create database tables on startup"""
23
22
  async with engine.begin() as conn:
24
- await conn.run_sync(SQLModel.metadata.create_all)
23
+ await conn.run_sync(AuthModel.metadata.create_all)
25
24
  print("✅ Database tables created")
26
25
  print("📝 Register a user at: POST /auth/users/register")
27
26
  print("🔐 Login at: POST /auth/token")
@@ -12,12 +12,12 @@ This example demonstrates:
12
12
  from fastapi import Depends, FastAPI
13
13
  from oauth2fast_fastapi import (
14
14
  User,
15
+ AuthModel,
15
16
  engine,
16
17
  get_current_user,
17
18
  get_current_verified_user,
18
19
  router,
19
20
  )
20
- from sqlmodel import SQLModel
21
21
 
22
22
  app = FastAPI(
23
23
  title="Complete Auth Flow Example",
@@ -32,7 +32,7 @@ app.include_router(router, prefix="/auth", tags=["Authentication"])
32
32
  async def startup():
33
33
  """Create database tables on startup"""
34
34
  async with engine.begin() as conn:
35
- await conn.run_sync(SQLModel.metadata.create_all)
35
+ await conn.run_sync(AuthModel.metadata.create_all)
36
36
  print("✅ Database ready")
37
37
  print("\n📋 Authentication Flow:")
38
38
  print("1. Register: POST /auth/users/register")
@@ -7,9 +7,9 @@ This example shows how to extend the base User model with custom fields.
7
7
  from datetime import datetime
8
8
 
9
9
  from fastapi import Depends, FastAPI
10
- from oauth2fast_fastapi import engine, get_current_user
10
+ from oauth2fast_fastapi import engine, get_current_user, AuthModel
11
11
  from oauth2fast_fastapi.models.user_model import User as BaseUser
12
- from sqlmodel import Field, SQLModel
12
+ from sqlmodel import Field
13
13
 
14
14
  # Extend the base User model with custom fields
15
15
  class CustomUser(BaseUser, table=True):
@@ -29,7 +29,7 @@ app = FastAPI(title="Custom User Model Example")
29
29
  async def startup():
30
30
  """Create database tables on startup"""
31
31
  async with engine.begin() as conn:
32
- await conn.run_sync(SQLModel.metadata.create_all)
32
+ await conn.run_sync(AuthModel.metadata.create_all)
33
33
  print("✅ Custom user tables created")
34
34
 
35
35
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "oauth2fast-fastapi"
7
- version = "0.2.3"
7
+ version = "0.2.4"
8
8
  description = "Fast and secure OAuth2 authentication module for FastAPI with email verification"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -10,7 +10,7 @@ from .database import (
10
10
  startup_database,
11
11
  )
12
12
  from .dependencies import get_auth_session, get_current_user, get_current_verified_user
13
- from .models.bases import AuthModel
13
+ from .models.bases import AuthModel, BasicAuthModel
14
14
  from .models.user_model import User
15
15
  from .routers.base_router import router
16
16
  from .schemas.user_schema import UserCreate, UserRead
@@ -29,6 +29,7 @@ __all__ = [
29
29
  "get_current_verified_user",
30
30
  # Models and schemas
31
31
  "AuthModel",
32
+ "BasicAuthModel",
32
33
  "User",
33
34
  "UserCreate",
34
35
  "UserRead",
@@ -0,0 +1 @@
1
+ __version__ = "0.2.4"
@@ -0,0 +1,2 @@
1
+ from .bases import AuthModel as AuthModel
2
+ from .bases import BasicAuthModel as BasicAuthModel
@@ -1,30 +1,28 @@
1
1
  from datetime import UTC, datetime
2
2
 
3
3
  from sqlalchemy import DateTime, func
4
- from sqlmodel import BigInteger, Column, Field
4
+ from sqlmodel import BigInteger, Field
5
5
 
6
6
 
7
7
  class IdMixin:
8
8
  """Mixin para proveer clave primaria autoincremental tipo BigInteger."""
9
9
 
10
- id: int = Field(
11
- default=None, sa_column=Column(BigInteger, index=True, primary_key=True)
12
- )
10
+ id: int | None = Field(default=None, primary_key=True, index=True, sa_type=BigInteger)
13
11
 
14
12
 
15
13
  class TimestampMixin:
16
14
  """Mixin reutilizable para marcas de tiempo en UTC."""
17
15
 
18
- created_at = Column(
19
- DateTime(timezone=True),
16
+ created_at: datetime = Field(
17
+ default_factory=lambda: datetime.now(UTC),
20
18
  nullable=False,
21
- default=lambda: datetime.now(UTC),
19
+ sa_type=DateTime(timezone=True),
22
20
  )
23
- updated_at = Column(
24
- DateTime(timezone=True),
21
+ updated_at: datetime = Field(
22
+ default_factory=lambda: datetime.now(UTC),
25
23
  nullable=False,
26
- default=lambda: datetime.now(UTC),
27
- onupdate=func.now(),
24
+ sa_type=DateTime(timezone=True),
25
+ sa_column_kwargs={"onupdate": func.now()},
28
26
  )
29
27
 
30
28
 
@@ -34,12 +32,12 @@ class AuditMixin:
34
32
  created_by: int | None = Field(
35
33
  default=None,
36
34
  description="ID of the user who created this record.",
37
- sa_column=Column(BigInteger),
35
+ sa_type=BigInteger,
38
36
  )
39
37
  updated_by: int | None = Field(
40
38
  default=None,
41
39
  description="ID of the user who last updated this record.",
42
- sa_column=Column(BigInteger),
40
+ sa_type=BigInteger,
43
41
  )
44
42
 
45
43
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oauth2fast-fastapi
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Fast and secure OAuth2 authentication module for FastAPI with email verification
5
5
  Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
6
6
  License: MIT License
@@ -112,21 +112,24 @@ ALGORITHM=HS256
112
112
  ACCESS_TOKEN_EXPIRE_MINUTES=60
113
113
 
114
114
  # Database Configuration
115
- AUTH_DB__USERNAME=postgres
116
- AUTH_DB__PASSWORD=yourpassword
117
- AUTH_DB__HOSTNAME=localhost
118
- AUTH_DB__NAME=myapp_db
119
- AUTH_DB__PORT=5432
115
+ DB_DEFAULT_CONNECTION=auth
116
+ DB_CONNECTIONS__AUTH__HOST=localhost
117
+ DB_CONNECTIONS__AUTH__PORT=5432
118
+ DB_CONNECTIONS__AUTH__USERNAME=postgres
119
+ DB_CONNECTIONS__AUTH__PASSWORD=yourpassword
120
+ DB_CONNECTIONS__AUTH__DATABASE=myapp_db
120
121
 
121
122
  # Mail Server Configuration
122
- AUTH_MAIL_SERVER__USERNAME=noreply@yourapp.com
123
- AUTH_MAIL_SERVER__PASSWORD=your-smtp-password
124
- AUTH_MAIL_SERVER__SERVER=smtp.gmail.com
125
- AUTH_MAIL_SERVER__PORT=587
126
- AUTH_MAIL_SERVER__FROM_DIRECTION=noreply@yourapp.com
127
- AUTH_MAIL_SERVER__FROM_NAME=Your App
128
- AUTH_MAIL_SERVER__STARTTLS=true
129
- AUTH_MAIL_SERVER__SSL_TLS=false
123
+ MAIL_DEFAULT_ACCOUNT=auth
124
+ MAIL_SMTP_ACCOUNTS__AUTH__HOST=smtp.gmail.com
125
+ MAIL_SMTP_ACCOUNTS__AUTH__PORT=587
126
+ MAIL_SMTP_ACCOUNTS__AUTH__USERNAME="noreply@yourapp.com"
127
+ MAIL_SMTP_ACCOUNTS__AUTH__PASSWORD="your-smtp-password"
128
+ MAIL_SMTP_ACCOUNTS__AUTH__SECURITY=tls
129
+ MAIL_SMTP_ACCOUNTS__AUTH__FROM_EMAIL="noreply@yourapp.com"
130
+ MAIL_SMTP_ACCOUNTS__AUTH__FROM_NAME="Your pp"
131
+ MAIL_SMTP_ACCOUNTS__AUTH__REPLY_TO="reply@yourapp.com"
132
+ MAIL_SMTP_ACCOUNTS__AUTH__TIMEOUT=60
130
133
 
131
134
  # Application Settings
132
135
  PROJECT_NAME=My App
@@ -1 +0,0 @@
1
- __version__ = "0.2.3"
@@ -1 +0,0 @@
1
- from .bases import AuthModel as AuthModel