VA7 Identity — Authentication, authorization, and user management
Project description
VA7 Identity
Authentication, authorization, and user management for Django SaaS applications.
Installation
pip install va7-identity
Quick Start
# settings.py
INSTALLED_APPS = [
...
"va7.core",
"va7.identity",
]
AUTH_USER_MODEL = "your_app.User" # Use AbstractRoleUser
AUTHENTICATION_BACKENDS = [
"va7.identity.backends.EmailBackend",
]
REST_FRAMEWORK = {
"DEFAULT_AUTHENTICATION_CLASSES": [
"rest_framework_simplejwt.authentication.JWTAuthentication",
],
}
User Model
# your_app/models.py
from va7.identity.models import AbstractRoleUser
class User(AbstractRoleUser):
class Role(AbstractRoleUser.Role):
ADMIN = "ADMIN", "Admin"
MEMBER = "MEMBER", "Member"
AbstractRoleUser fields:
id— UUID primary keyemail— Unique, used as USERNAME_FIELDusername,first_name,last_name— Optionalrole— Nullable CharField (for single-tenant apps)is_email_verified— Booleanis_active,is_staff— Standard Django fieldscreated_at,updated_at— Auto-managed timestamps
Properties:
is_admin— True ifrole == "ADMIN"oris_superuserfull_name— Concatenation of first/last name
Endpoints
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/identity/register/ |
POST | No | Create new user |
/identity/login/ |
POST | No | Get JWT tokens |
/identity/logout/ |
POST | Yes | Blacklist refresh token |
/identity/profile/ |
GET/PATCH | Yes | User profile |
/identity/password-reset/request/ |
POST | No | Request password reset OTP |
/identity/password-reset/confirm/ |
POST | No | Confirm with OTP |
/identity/verify-email/ |
POST | No | Verify email with OTP |
/identity/resend-verification/ |
POST | No | Resend verification OTP |
Project Structure
va7-identity/
├── pyproject.toml
├── va7/
│ ├── identity/
│ │ ├── __init__.py # Public API (lazy imports)
│ │ ├── models/
│ │ │ ├── __init__.py
│ │ │ └── abstract_user.py # AbstractRoleUser, AbstractToken, RoleFieldMixin
│ │ ├── backends/
│ │ │ ├── __init__.py
│ │ │ └── password.py # EmailBackend
│ │ ├── permissions/
│ │ │ ├── __init__.py
│ │ │ ├── base.py # HasRole
│ │ │ └── combinators.py # And, Or, Not
│ │ ├── services/
│ │ │ ├── __init__.py
│ │ │ ├── base.py # VerificationMethod ABC
│ │ │ ├── otp.py # OTPMethod, OTPService
│ │ │ ├── email.py # EmailVerificationService
│ │ │ ├── registration.py # RegistrationService
│ │ │ ├── password.py # PasswordResetService
│ │ │ └── tokens.py # generate_tokens, blacklist_refresh_token
│ │ ├── events.py # Event constants
│ │ ├── serializers.py
│ │ ├── views.py
│ │ ├── urls.py
│ │ └── apps.py
│ └── conf/
└── tests/
Testing
pip install -e "packages/va7-identity[dev]"
pytest tests/ -v
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file va7_identity-0.1.0-py3-none-any.whl.
File metadata
- Download URL: va7_identity-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f4169a1dc92080e5cb3f123c6a73c38bf92dad6ed3b1260a611e4c5f6896d43
|
|
| MD5 |
91cea3ecad86e7d00f9398a6f9c9a8fc
|
|
| BLAKE2b-256 |
b796038a51ec4644abed86943e15c09b4a7f1b4adf5900eb9709aaef17baa3e3
|