django-light-auth 0.2.2__tar.gz → 0.2.3__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.
- {django-light-auth-0.2.2 → django_light_auth-0.2.3}/PKG-INFO +33 -23
- {django-light-auth-0.2.2 → django_light_auth-0.2.3}/README.md +24 -14
- django_light_auth-0.2.3/django_light_auth/__init__.py +12 -0
- django_light_auth-0.2.3/django_light_auth/admin.py +3 -0
- {django-light-auth-0.2.2 → django_light_auth-0.2.3}/django_light_auth/apps.py +1 -2
- {django-light-auth-0.2.2 → django_light_auth-0.2.3}/django_light_auth/runtimes.py +26 -31
- django_light_auth-0.2.3/django_light_auth/tests.py +3 -0
- {django-light-auth-0.2.2 → django_light_auth-0.2.3}/django_light_auth.egg-info/PKG-INFO +33 -23
- {django-light-auth-0.2.2 → django_light_auth-0.2.3}/django_light_auth.egg-info/SOURCES.txt +2 -2
- django_light_auth-0.2.3/django_light_auth.egg-info/requires.txt +1 -0
- django_light_auth-0.2.3/pyproject.toml +33 -0
- django_light_auth-0.2.3/requirements.d/base.txt +2 -0
- django_light_auth-0.2.3/setup.cfg +7 -0
- django-light-auth-0.2.2/django_light_auth/__init__.py +0 -23
- django-light-auth-0.2.2/django_light_auth/admin.py +0 -3
- django-light-auth-0.2.2/django_light_auth/tests.py +0 -3
- django-light-auth-0.2.2/django_light_auth.egg-info/requires.txt +0 -1
- django-light-auth-0.2.2/pyproject.toml +0 -5
- django-light-auth-0.2.2/setup.cfg +0 -14
- django-light-auth-0.2.2/setup.py +0 -214
- {django-light-auth-0.2.2 → django_light_auth-0.2.3}/LICENSE +0 -0
- {django-light-auth-0.2.2 → django_light_auth-0.2.3}/django_light_auth/views.py +0 -0
- {django-light-auth-0.2.2 → django_light_auth-0.2.3}/django_light_auth.egg-info/dependency_links.txt +0 -0
- {django-light-auth-0.2.2 → django_light_auth-0.2.3}/django_light_auth.egg-info/top_level.txt +0 -0
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: django-light-auth
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: Django Lightweight Authentication without models and databases, only depend on the Django's SessionMiddleware.
|
|
5
|
-
Home-page: https://github.com/rexzhang/django-light-auth
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware.
|
|
6
5
|
Author: Rex Zhang
|
|
7
6
|
Author-email: rex.zhang@gmail.com
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Classifier:
|
|
11
|
-
Classifier:
|
|
12
|
-
|
|
13
|
-
Requires-Python: >=3.5
|
|
7
|
+
Project-URL: homepage, https://github.com/rexzhang/django-light-auth
|
|
8
|
+
Keywords: django,auth
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Framework :: Django :: 5.0
|
|
11
|
+
Requires-Python: >=3.10
|
|
14
12
|
Description-Content-Type: text/markdown
|
|
15
13
|
License-File: LICENSE
|
|
14
|
+
Requires-Dist: django>=5.0
|
|
15
|
+
Dynamic: license-file
|
|
16
16
|
|
|
17
17
|
# django-light-auth
|
|
18
18
|
|
|
19
|
-
[](https://pypi.org/project/django-light-auth/)
|
|
20
|
-
|
|
21
|
-
[](https://pypi.org/project/django-light-auth/)
|
|
20
|
+

|
|
21
|
+
[](https://pypi.org/project/django-light-auth/)
|
|
22
|
+
[](https://pypi.org/project/django-light-auth/)
|
|
22
23
|
|
|
23
|
-
> Django Lightweight Authentication without models and databases, only depend on the Django's SessionMiddleware.
|
|
24
|
+
> Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware.
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
## Install
|
|
26
27
|
|
|
27
28
|
```shell
|
|
28
29
|
pip3 install -U django-light-auth
|
|
29
30
|
```
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
## Usage
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
### Basic Usage
|
|
35
|
+
|
|
36
|
+
#### `settings.py`
|
|
34
37
|
|
|
35
38
|
```python
|
|
36
39
|
INSTALLED_APPS = [
|
|
37
40
|
# ...
|
|
38
41
|
# 'django.contrib.auth',
|
|
39
|
-
'django_light_auth',
|
|
42
|
+
'django_light_auth.apps.DjangoLightAuthConfig',
|
|
40
43
|
|
|
41
44
|
# ...
|
|
42
45
|
]
|
|
@@ -58,7 +61,7 @@ SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
|
|
|
58
61
|
LIGHT_AUTH_VALIDATE_FUNC = 'your_app.auth.validate_func'
|
|
59
62
|
```
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
#### `urls.py`
|
|
62
65
|
|
|
63
66
|
```python
|
|
64
67
|
from django.urls import path
|
|
@@ -72,7 +75,8 @@ urlpatterns = [
|
|
|
72
75
|
]
|
|
73
76
|
```
|
|
74
77
|
|
|
75
|
-
|
|
78
|
+
#### `your_app/auth/validate_func.py`
|
|
79
|
+
|
|
76
80
|
```python
|
|
77
81
|
#
|
|
78
82
|
# example at django_light_auth.light_auth_validate_func
|
|
@@ -91,9 +95,10 @@ def light_auth_validate_func(data: Dict[str, Any]) -> bool:
|
|
|
91
95
|
return False
|
|
92
96
|
```
|
|
93
97
|
|
|
94
|
-
|
|
98
|
+
### Custom Login View
|
|
95
99
|
|
|
96
100
|
`your_login_view.py`
|
|
101
|
+
|
|
97
102
|
```python
|
|
98
103
|
from django_light_auth import LoginView as LoginViewAbs
|
|
99
104
|
|
|
@@ -102,7 +107,12 @@ class LoginView(LoginViewAbs):
|
|
|
102
107
|
template_name = 'your_app/login.html'
|
|
103
108
|
```
|
|
104
109
|
|
|
105
|
-
|
|
110
|
+
## History
|
|
111
|
+
|
|
112
|
+
### 0.2.3 - 20251112
|
|
113
|
+
|
|
114
|
+
- Maintenance release
|
|
115
|
+
|
|
116
|
+
### v0.2.2 - 20220809
|
|
106
117
|
|
|
107
|
-
## v0.2.2 - 20220809
|
|
108
118
|
- Compatible Django 4.1+
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
# django-light-auth
|
|
2
2
|
|
|
3
|
-
[](https://pypi.org/project/django-light-auth/)
|
|
4
|
-
|
|
5
|
-
[](https://pypi.org/project/django-light-auth/)
|
|
4
|
+

|
|
5
|
+
[](https://pypi.org/project/django-light-auth/)
|
|
6
|
+
[](https://pypi.org/project/django-light-auth/)
|
|
6
7
|
|
|
7
|
-
> Django Lightweight Authentication without models and databases, only depend on the Django's SessionMiddleware.
|
|
8
|
+
> Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
## Install
|
|
10
11
|
|
|
11
12
|
```shell
|
|
12
13
|
pip3 install -U django-light-auth
|
|
13
14
|
```
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
## Usage
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
### Basic Usage
|
|
19
|
+
|
|
20
|
+
#### `settings.py`
|
|
18
21
|
|
|
19
22
|
```python
|
|
20
23
|
INSTALLED_APPS = [
|
|
21
24
|
# ...
|
|
22
25
|
# 'django.contrib.auth',
|
|
23
|
-
'django_light_auth',
|
|
26
|
+
'django_light_auth.apps.DjangoLightAuthConfig',
|
|
24
27
|
|
|
25
28
|
# ...
|
|
26
29
|
]
|
|
@@ -42,7 +45,7 @@ SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
|
|
|
42
45
|
LIGHT_AUTH_VALIDATE_FUNC = 'your_app.auth.validate_func'
|
|
43
46
|
```
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
#### `urls.py`
|
|
46
49
|
|
|
47
50
|
```python
|
|
48
51
|
from django.urls import path
|
|
@@ -56,7 +59,8 @@ urlpatterns = [
|
|
|
56
59
|
]
|
|
57
60
|
```
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
#### `your_app/auth/validate_func.py`
|
|
63
|
+
|
|
60
64
|
```python
|
|
61
65
|
#
|
|
62
66
|
# example at django_light_auth.light_auth_validate_func
|
|
@@ -75,9 +79,10 @@ def light_auth_validate_func(data: Dict[str, Any]) -> bool:
|
|
|
75
79
|
return False
|
|
76
80
|
```
|
|
77
81
|
|
|
78
|
-
|
|
82
|
+
### Custom Login View
|
|
79
83
|
|
|
80
84
|
`your_login_view.py`
|
|
85
|
+
|
|
81
86
|
```python
|
|
82
87
|
from django_light_auth import LoginView as LoginViewAbs
|
|
83
88
|
|
|
@@ -86,7 +91,12 @@ class LoginView(LoginViewAbs):
|
|
|
86
91
|
template_name = 'your_app/login.html'
|
|
87
92
|
```
|
|
88
93
|
|
|
89
|
-
|
|
94
|
+
## History
|
|
95
|
+
|
|
96
|
+
### 0.2.3 - 20251112
|
|
97
|
+
|
|
98
|
+
- Maintenance release
|
|
99
|
+
|
|
100
|
+
### v0.2.2 - 20220809
|
|
90
101
|
|
|
91
|
-
|
|
92
|
-
- Compatible Django 4.1+
|
|
102
|
+
- Compatible Django 4.1+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from django_light_auth.runtimes import ( # noqa F401
|
|
2
|
+
LightAuthMiddleware,
|
|
3
|
+
do_login,
|
|
4
|
+
do_logout,
|
|
5
|
+
do_validate,
|
|
6
|
+
light_auth_validate_func,
|
|
7
|
+
)
|
|
8
|
+
from django_light_auth.views import LoginForm, LoginView, LogoutView # noqa F401
|
|
9
|
+
|
|
10
|
+
default_app_config = "django_light_auth.apps.DjangoLightAuthConfig"
|
|
11
|
+
|
|
12
|
+
__version__ = "0.2.3"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from datetime import datetime, timedelta
|
|
2
|
-
from typing import Union
|
|
3
2
|
from uuid import uuid4
|
|
4
3
|
|
|
5
4
|
from django.apps import AppConfig
|
|
@@ -20,7 +19,7 @@ class DjangoLightAuthConfig(AppConfig):
|
|
|
20
19
|
|
|
21
20
|
token = uuid4().hex
|
|
22
21
|
# https://docs.djangoproject.com/en/3.1/topics/http/sessions/
|
|
23
|
-
expiry:
|
|
22
|
+
expiry: None | int | datetime | timedelta = 3600 # 1 hour
|
|
24
23
|
|
|
25
24
|
def ready(self):
|
|
26
25
|
# func
|
|
@@ -1,54 +1,51 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from
|
|
2
|
+
from collections.abc import Callable
|
|
3
|
+
from typing import Any
|
|
3
4
|
|
|
4
5
|
from django.apps import apps
|
|
5
6
|
from django.http import HttpRequest, HttpResponseRedirect
|
|
6
7
|
|
|
7
8
|
logger = logging.getLogger(__file__)
|
|
8
9
|
|
|
9
|
-
TOKEN_KEY =
|
|
10
|
+
TOKEN_KEY = "light_auth_token"
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def _get_session_from_request(request: HttpRequest):
|
|
13
14
|
try:
|
|
14
|
-
session = request.__getattribute__(
|
|
15
|
+
session = request.__getattribute__("session")
|
|
15
16
|
except AttributeError:
|
|
16
17
|
raise Exception(
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
"Missed django.contrib.sessions.middleware.SessionMiddleware, "
|
|
19
|
+
"django-light-auth depend it."
|
|
19
20
|
)
|
|
20
21
|
return session
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
def do_login(request: HttpRequest) -> str:
|
|
24
25
|
session = _get_session_from_request(request)
|
|
25
|
-
session[TOKEN_KEY] = apps.get_app_config(
|
|
26
|
-
|
|
27
|
-
).token
|
|
28
|
-
expiry = apps.get_app_config('django_light_auth').expiry
|
|
26
|
+
session[TOKEN_KEY] = apps.get_app_config("django_light_auth").token
|
|
27
|
+
expiry = apps.get_app_config("django_light_auth").expiry
|
|
29
28
|
if expiry is not None:
|
|
30
29
|
# https://docs.djangoproject.com/en/3.1/topics/http/sessions/
|
|
31
30
|
# "If value is None,
|
|
32
31
|
# the session reverts to using the global session expiry policy."
|
|
33
|
-
session.set_expiry(
|
|
34
|
-
apps.get_app_config('django_light_auth').expiry
|
|
35
|
-
)
|
|
32
|
+
session.set_expiry(apps.get_app_config("django_light_auth").expiry)
|
|
36
33
|
|
|
37
|
-
return apps.get_app_config(
|
|
34
|
+
return apps.get_app_config("django_light_auth").success_path
|
|
38
35
|
|
|
39
36
|
|
|
40
37
|
def do_logout(request: HttpRequest) -> str:
|
|
41
38
|
session = _get_session_from_request(request)
|
|
42
39
|
session[TOKEN_KEY] = False
|
|
43
40
|
|
|
44
|
-
return apps.get_app_config(
|
|
41
|
+
return apps.get_app_config("django_light_auth").login_path
|
|
45
42
|
|
|
46
43
|
|
|
47
|
-
def _import_func(func_name: str, father_model=None) ->
|
|
44
|
+
def _import_func(func_name: str, father_model=None) -> Callable | None:
|
|
48
45
|
try:
|
|
49
|
-
index = func_name.find(
|
|
46
|
+
index = func_name.find(".")
|
|
50
47
|
if index == -1:
|
|
51
|
-
func = getattr(father_model, func_name[index + 1:])
|
|
48
|
+
func = getattr(father_model, func_name[index + 1 :])
|
|
52
49
|
return func
|
|
53
50
|
|
|
54
51
|
else:
|
|
@@ -58,22 +55,20 @@ def _import_func(func_name: str, father_model=None) -> Optional[Callable]:
|
|
|
58
55
|
else:
|
|
59
56
|
module = getattr(father_model, func_name[:index])
|
|
60
57
|
|
|
61
|
-
return _import_func(func_name[index + 1:], module)
|
|
58
|
+
return _import_func(func_name[index + 1 :], module)
|
|
62
59
|
|
|
63
60
|
except (ImportError, AttributeError, ValueError) as e:
|
|
64
61
|
logger.error(e)
|
|
65
|
-
logger.error(
|
|
66
|
-
func_name, father_model
|
|
67
|
-
))
|
|
62
|
+
logger.error(f"func_name: {func_name}, father_model:{father_model}")
|
|
68
63
|
return None
|
|
69
64
|
|
|
70
65
|
|
|
71
|
-
def do_validate(data:
|
|
72
|
-
func_name = apps.get_app_config(
|
|
66
|
+
def do_validate(data: dict[str, Any]) -> bool:
|
|
67
|
+
func_name = apps.get_app_config("django_light_auth").validate_func
|
|
73
68
|
|
|
74
69
|
func = _import_func(func_name)
|
|
75
70
|
if func is None:
|
|
76
|
-
raise ImportError(
|
|
71
|
+
raise ImportError(f"Can import: {func_name}")
|
|
77
72
|
|
|
78
73
|
if func(data):
|
|
79
74
|
return True
|
|
@@ -81,22 +76,22 @@ def do_validate(data: Dict[str, Any]) -> bool:
|
|
|
81
76
|
return False
|
|
82
77
|
|
|
83
78
|
|
|
84
|
-
def light_auth_validate_func(data:
|
|
79
|
+
def light_auth_validate_func(data: dict[str, Any]) -> bool:
|
|
85
80
|
"""demo for setting.LIGHT_AUTH_VALIDATE_FUNC"""
|
|
86
|
-
if data.get(
|
|
81
|
+
if data.get("username", None) == data.get("password", None):
|
|
87
82
|
return True
|
|
88
83
|
|
|
89
84
|
return False
|
|
90
85
|
|
|
91
86
|
|
|
92
87
|
def validate_request(request: HttpRequest) -> bool:
|
|
93
|
-
path = request.path.rstrip(
|
|
94
|
-
if path in apps.get_app_config(
|
|
88
|
+
path = request.path.rstrip("/")
|
|
89
|
+
if path in apps.get_app_config("django_light_auth").allow_paths:
|
|
95
90
|
return True
|
|
96
91
|
|
|
97
92
|
session = _get_session_from_request(request)
|
|
98
|
-
token = session.get(TOKEN_KEY,
|
|
99
|
-
if token == apps.get_app_config(
|
|
93
|
+
token = session.get(TOKEN_KEY, "")
|
|
94
|
+
if token == apps.get_app_config("django_light_auth").token:
|
|
100
95
|
return True
|
|
101
96
|
|
|
102
97
|
return False
|
|
@@ -118,7 +113,7 @@ class LightAuthMiddleware:
|
|
|
118
113
|
|
|
119
114
|
if not validate_request(request):
|
|
120
115
|
return HttpResponseRedirect(
|
|
121
|
-
apps.get_app_config(
|
|
116
|
+
apps.get_app_config("django_light_auth").login_path
|
|
122
117
|
)
|
|
123
118
|
|
|
124
119
|
return response
|
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: django-light-auth
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: Django Lightweight Authentication without models and databases, only depend on the Django's SessionMiddleware.
|
|
5
|
-
Home-page: https://github.com/rexzhang/django-light-auth
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware.
|
|
6
5
|
Author: Rex Zhang
|
|
7
6
|
Author-email: rex.zhang@gmail.com
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Classifier:
|
|
11
|
-
Classifier:
|
|
12
|
-
|
|
13
|
-
Requires-Python: >=3.5
|
|
7
|
+
Project-URL: homepage, https://github.com/rexzhang/django-light-auth
|
|
8
|
+
Keywords: django,auth
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Framework :: Django :: 5.0
|
|
11
|
+
Requires-Python: >=3.10
|
|
14
12
|
Description-Content-Type: text/markdown
|
|
15
13
|
License-File: LICENSE
|
|
14
|
+
Requires-Dist: django>=5.0
|
|
15
|
+
Dynamic: license-file
|
|
16
16
|
|
|
17
17
|
# django-light-auth
|
|
18
18
|
|
|
19
|
-
[](https://pypi.org/project/django-light-auth/)
|
|
20
|
-
|
|
21
|
-
[](https://pypi.org/project/django-light-auth/)
|
|
20
|
+

|
|
21
|
+
[](https://pypi.org/project/django-light-auth/)
|
|
22
|
+
[](https://pypi.org/project/django-light-auth/)
|
|
22
23
|
|
|
23
|
-
> Django Lightweight Authentication without models and databases, only depend on the Django's SessionMiddleware.
|
|
24
|
+
> Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware.
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
## Install
|
|
26
27
|
|
|
27
28
|
```shell
|
|
28
29
|
pip3 install -U django-light-auth
|
|
29
30
|
```
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
## Usage
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
### Basic Usage
|
|
35
|
+
|
|
36
|
+
#### `settings.py`
|
|
34
37
|
|
|
35
38
|
```python
|
|
36
39
|
INSTALLED_APPS = [
|
|
37
40
|
# ...
|
|
38
41
|
# 'django.contrib.auth',
|
|
39
|
-
'django_light_auth',
|
|
42
|
+
'django_light_auth.apps.DjangoLightAuthConfig',
|
|
40
43
|
|
|
41
44
|
# ...
|
|
42
45
|
]
|
|
@@ -58,7 +61,7 @@ SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
|
|
|
58
61
|
LIGHT_AUTH_VALIDATE_FUNC = 'your_app.auth.validate_func'
|
|
59
62
|
```
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
#### `urls.py`
|
|
62
65
|
|
|
63
66
|
```python
|
|
64
67
|
from django.urls import path
|
|
@@ -72,7 +75,8 @@ urlpatterns = [
|
|
|
72
75
|
]
|
|
73
76
|
```
|
|
74
77
|
|
|
75
|
-
|
|
78
|
+
#### `your_app/auth/validate_func.py`
|
|
79
|
+
|
|
76
80
|
```python
|
|
77
81
|
#
|
|
78
82
|
# example at django_light_auth.light_auth_validate_func
|
|
@@ -91,9 +95,10 @@ def light_auth_validate_func(data: Dict[str, Any]) -> bool:
|
|
|
91
95
|
return False
|
|
92
96
|
```
|
|
93
97
|
|
|
94
|
-
|
|
98
|
+
### Custom Login View
|
|
95
99
|
|
|
96
100
|
`your_login_view.py`
|
|
101
|
+
|
|
97
102
|
```python
|
|
98
103
|
from django_light_auth import LoginView as LoginViewAbs
|
|
99
104
|
|
|
@@ -102,7 +107,12 @@ class LoginView(LoginViewAbs):
|
|
|
102
107
|
template_name = 'your_app/login.html'
|
|
103
108
|
```
|
|
104
109
|
|
|
105
|
-
|
|
110
|
+
## History
|
|
111
|
+
|
|
112
|
+
### 0.2.3 - 20251112
|
|
113
|
+
|
|
114
|
+
- Maintenance release
|
|
115
|
+
|
|
116
|
+
### v0.2.2 - 20220809
|
|
106
117
|
|
|
107
|
-
## v0.2.2 - 20220809
|
|
108
118
|
- Compatible Django 4.1+
|
|
@@ -2,7 +2,6 @@ LICENSE
|
|
|
2
2
|
README.md
|
|
3
3
|
pyproject.toml
|
|
4
4
|
setup.cfg
|
|
5
|
-
setup.py
|
|
6
5
|
django_light_auth/__init__.py
|
|
7
6
|
django_light_auth/admin.py
|
|
8
7
|
django_light_auth/apps.py
|
|
@@ -13,4 +12,5 @@ django_light_auth.egg-info/PKG-INFO
|
|
|
13
12
|
django_light_auth.egg-info/SOURCES.txt
|
|
14
13
|
django_light_auth.egg-info/dependency_links.txt
|
|
15
14
|
django_light_auth.egg-info/requires.txt
|
|
16
|
-
django_light_auth.egg-info/top_level.txt
|
|
15
|
+
django_light_auth.egg-info/top_level.txt
|
|
16
|
+
requirements.d/base.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
django>=5.0
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
# These are the assumed default build requirements from pip:
|
|
3
|
+
# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
|
|
4
|
+
requires = ["setuptools>=40.8.0", "wheel"]
|
|
5
|
+
build-backend = "setuptools.build_meta"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
dynamic = ["version", "dependencies"]
|
|
9
|
+
|
|
10
|
+
name = "django-light-auth"
|
|
11
|
+
description = "Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
authors = [{ name = "Rex Zhang" }, { email = "rex.zhang@gmail.com" }]
|
|
16
|
+
keywords = ["django", "auth"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
'Framework :: Django :: 5.0',
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
homepage = "https://github.com/rexzhang/django-light-auth"
|
|
24
|
+
|
|
25
|
+
[tool.setuptools]
|
|
26
|
+
packages = ["django_light_auth"]
|
|
27
|
+
|
|
28
|
+
[tool.setuptools.dynamic]
|
|
29
|
+
version = { attr = "django_light_auth.__version__" }
|
|
30
|
+
dependencies = { file = "requirements.d/base.txt" }
|
|
31
|
+
|
|
32
|
+
[tool.isort]
|
|
33
|
+
profile = "black"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from django_light_auth.runtimes import (
|
|
2
|
-
LightAuthMiddleware,
|
|
3
|
-
do_login,
|
|
4
|
-
do_logout,
|
|
5
|
-
do_validate,
|
|
6
|
-
light_auth_validate_func,
|
|
7
|
-
)
|
|
8
|
-
from django_light_auth.views import LoginForm, LoginView, LogoutView
|
|
9
|
-
|
|
10
|
-
default_app_config = "django_light_auth.apps.DjangoLightAuthConfig"
|
|
11
|
-
|
|
12
|
-
__name__ = "django-light-auth"
|
|
13
|
-
__version__ = "0.2.2"
|
|
14
|
-
|
|
15
|
-
__author__ = "Rex Zhang"
|
|
16
|
-
__author_email__ = "rex.zhang@gmail.com"
|
|
17
|
-
__licence__ = "MIT"
|
|
18
|
-
|
|
19
|
-
__description__ = (
|
|
20
|
-
"Django Lightweight Authentication without models and "
|
|
21
|
-
"databases, only depend on the Django's SessionMiddleware."
|
|
22
|
-
)
|
|
23
|
-
__project_url__ = "https://github.com/rexzhang/django-light-auth"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
django
|
django-light-auth-0.2.2/setup.py
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# coding=utf-8
|
|
3
|
-
|
|
4
|
-
# Template:
|
|
5
|
-
# https://github.com/rexzhang/pypi-package-project-template/blob/master/setup.py
|
|
6
|
-
|
|
7
|
-
from typing import List
|
|
8
|
-
|
|
9
|
-
# Always prefer setuptools over distutils
|
|
10
|
-
from setuptools import setup, find_packages
|
|
11
|
-
|
|
12
|
-
# To use a consistent encoding
|
|
13
|
-
from codecs import open
|
|
14
|
-
from pathlib import Path
|
|
15
|
-
|
|
16
|
-
import django_light_auth as module
|
|
17
|
-
|
|
18
|
-
root_path = Path(__file__).parent
|
|
19
|
-
requirements_path = root_path.joinpath('requirements')
|
|
20
|
-
|
|
21
|
-
# Get the long description from the README file
|
|
22
|
-
with open(root_path.joinpath('README.md'), encoding='utf-8') as f:
|
|
23
|
-
long_description = f.read()
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# Get install_requires from requirements.txt
|
|
27
|
-
def _read_requires_from_requirements_txt(
|
|
28
|
-
base_path: Path, filename: str, ignore_base: bool = False
|
|
29
|
-
) -> List[str]:
|
|
30
|
-
_requires = []
|
|
31
|
-
with open(
|
|
32
|
-
base_path.joinpath(filename).as_posix(), encoding='utf-8'
|
|
33
|
-
) as req_f:
|
|
34
|
-
lines = req_f.readlines()
|
|
35
|
-
for line in lines:
|
|
36
|
-
if line == '\n' or line == '' or line[0] == '#':
|
|
37
|
-
continue
|
|
38
|
-
|
|
39
|
-
words = line.rstrip('\n').split(' ')
|
|
40
|
-
if words[0] == '-r':
|
|
41
|
-
if ignore_base and words[1] == 'base.txt':
|
|
42
|
-
continue
|
|
43
|
-
|
|
44
|
-
else:
|
|
45
|
-
_requires.extend(
|
|
46
|
-
_read_requires_from_requirements_txt(
|
|
47
|
-
base_path=base_path, filename=words[1]
|
|
48
|
-
)
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
else:
|
|
52
|
-
_requires.append(words[0])
|
|
53
|
-
|
|
54
|
-
return _requires
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
install_requires = _read_requires_from_requirements_txt(
|
|
58
|
-
base_path=requirements_path, filename='base.txt'
|
|
59
|
-
)
|
|
60
|
-
extras_require_dev = list(set(_read_requires_from_requirements_txt(
|
|
61
|
-
base_path=requirements_path, filename='dev.txt'
|
|
62
|
-
)))
|
|
63
|
-
|
|
64
|
-
# Setup
|
|
65
|
-
setup(
|
|
66
|
-
# This is the name of your project. The first time you publish this
|
|
67
|
-
# package, this name will be registered for you. It will determine how
|
|
68
|
-
# users can install this project, e.g.:
|
|
69
|
-
#
|
|
70
|
-
# $ pip install sampleproject
|
|
71
|
-
#
|
|
72
|
-
# And where it will live on PyPI: https://pypi.org/project/sampleproject/
|
|
73
|
-
#
|
|
74
|
-
# There are some restrictions on what makes a valid project name
|
|
75
|
-
# specification here:
|
|
76
|
-
# https://packaging.python.org/specifications/core-metadata/#name
|
|
77
|
-
name=module.__name__, # Required
|
|
78
|
-
|
|
79
|
-
# Versions should comply with PEP 440:
|
|
80
|
-
# https://www.python.org/dev/peps/pep-0440/
|
|
81
|
-
#
|
|
82
|
-
# For a discussion on single-sourcing the version across setup.py and the
|
|
83
|
-
# project code, see
|
|
84
|
-
# https://packaging.python.org/en/latest/single_source_version.html
|
|
85
|
-
version=module.__version__, # Required
|
|
86
|
-
|
|
87
|
-
# This is a one-line description or tagline of what your project does. This
|
|
88
|
-
# corresponds to the "Summary" metadata field:
|
|
89
|
-
# https://packaging.python.org/specifications/core-metadata/#summary
|
|
90
|
-
description=module.__description__, # Optional
|
|
91
|
-
# This is an optional longer description of your project that represents
|
|
92
|
-
# the body of text which users will see when they visit PyPI.
|
|
93
|
-
#
|
|
94
|
-
# Often, this is the same as your README, so you can just read it in from
|
|
95
|
-
# that file directly (as we have already done above)
|
|
96
|
-
#
|
|
97
|
-
# This field corresponds to the "Description" metadata field:
|
|
98
|
-
# https://packaging.python.org/specifications/core-metadata/#description-optional
|
|
99
|
-
long_description=long_description, # Optional
|
|
100
|
-
# Denotes that our long_description is in Markdown; valid values are
|
|
101
|
-
# text/plain, text/x-rst, and text/markdown
|
|
102
|
-
#
|
|
103
|
-
# Optional if long_description is written in reStructuredText (rst) but
|
|
104
|
-
# required for plain-text or Markdown; if unspecified, "applications should
|
|
105
|
-
# attempt to render [the long_description] as text/x-rst; charset=UTF-8 and
|
|
106
|
-
# fall back to text/plain if it is not valid rst" (see link below)
|
|
107
|
-
#
|
|
108
|
-
# This field corresponds to the "Description-Content-Type" metadata field:
|
|
109
|
-
# https://packaging.python.org/specifications/core-metadata/#description-content-type-optional
|
|
110
|
-
long_description_content_type='text/markdown', # Optional (see note above)
|
|
111
|
-
|
|
112
|
-
# This should be a valid link to your project's main homepage.
|
|
113
|
-
#
|
|
114
|
-
# This field corresponds to the "Home-Page" metadata field:
|
|
115
|
-
# https://packaging.python.org/specifications/core-metadata/#home-page-optional
|
|
116
|
-
url=module.__project_url__, # Optional
|
|
117
|
-
|
|
118
|
-
# This should be your name or the name of the organization which owns the
|
|
119
|
-
# project.
|
|
120
|
-
author=module.__author__, # Optional
|
|
121
|
-
# This should be a valid email address corresponding to the author listed
|
|
122
|
-
# above.
|
|
123
|
-
author_email=module.__author_email__, # Optional
|
|
124
|
-
|
|
125
|
-
# # Choose your license
|
|
126
|
-
# license=module.__licence__,
|
|
127
|
-
|
|
128
|
-
# Classifiers help users find your project by categorizing it.
|
|
129
|
-
#
|
|
130
|
-
# For a list of valid classifiers, see https://pypi.org/classifiers/
|
|
131
|
-
classifiers=[ # Optional
|
|
132
|
-
# How mature is this project? Common values are
|
|
133
|
-
# 3 - Alpha
|
|
134
|
-
# 4 - Beta
|
|
135
|
-
# 5 - Production/Stable
|
|
136
|
-
'Development Status :: 3 - Alpha',
|
|
137
|
-
|
|
138
|
-
# Indicate who your project is intended for
|
|
139
|
-
|
|
140
|
-
# Pick your license as you wish
|
|
141
|
-
'License :: OSI Approved :: MIT License',
|
|
142
|
-
|
|
143
|
-
# Specify the Python versions you support here. In particular, ensure
|
|
144
|
-
# that you indicate whether you support Python 2, Python 3 or both.
|
|
145
|
-
# These classifiers are *not* checked by 'pip install'. See instead
|
|
146
|
-
# 'python_requires' below.
|
|
147
|
-
'Programming Language :: Python :: 3',
|
|
148
|
-
|
|
149
|
-
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
150
|
-
],
|
|
151
|
-
|
|
152
|
-
# This field adds keywords for your project which will appear on the
|
|
153
|
-
# project page. What does your project relate to?
|
|
154
|
-
#
|
|
155
|
-
# Note that this is a string of words separated by whitespace, not a list.
|
|
156
|
-
keywords='django auth', # Optional
|
|
157
|
-
|
|
158
|
-
# When your source code is in a subdirectory under the project root, e.g.
|
|
159
|
-
# `src/`, it is necessary to specify the `package_dir` argument.
|
|
160
|
-
# package_dir={'': 'src'}, # Optional
|
|
161
|
-
|
|
162
|
-
# You can just specify package directories manually here if your project is
|
|
163
|
-
# simple. Or you can use find_packages().
|
|
164
|
-
#
|
|
165
|
-
# Alternatively, if you just want to distribute a single Python file, use
|
|
166
|
-
# the `py_modules` argument instead as follows, which will expect a file
|
|
167
|
-
# called `my_module.py` to exist:
|
|
168
|
-
#
|
|
169
|
-
# py_modules=["my_module"],
|
|
170
|
-
#
|
|
171
|
-
# packages=find_packages(where='src'), # Required
|
|
172
|
-
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
|
|
173
|
-
|
|
174
|
-
# Specify which Python versions you support. In contrast to the
|
|
175
|
-
# 'Programming Language' classifiers above, 'pip install' will check this
|
|
176
|
-
# and refuse to install the project if the version does not match. If you
|
|
177
|
-
# do not support Python 2, you can simplify this to '>=3.5' or similar, see
|
|
178
|
-
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
|
|
179
|
-
python_requires='>=3.5',
|
|
180
|
-
|
|
181
|
-
# This field lists other packages that your project depends on to run.
|
|
182
|
-
# Any package you put here will be installed by pip when your project is
|
|
183
|
-
# installed, so they must be valid existing projects.
|
|
184
|
-
#
|
|
185
|
-
# For an analysis of "install_requires" vs pip's requirements files see:
|
|
186
|
-
# https://packaging.python.org/en/latest/requirements.html
|
|
187
|
-
install_requires=install_requires, # Optional
|
|
188
|
-
|
|
189
|
-
# List additional groups of dependencies here (e.g. development
|
|
190
|
-
# dependencies). Users will be able to install these using the "extras"
|
|
191
|
-
# syntax, for example:
|
|
192
|
-
#
|
|
193
|
-
# $ pip install sampleproject[dev]
|
|
194
|
-
#
|
|
195
|
-
# Similar to `install_requires` above, these must be valid existing
|
|
196
|
-
# projects.
|
|
197
|
-
# extras_require={ # Optional
|
|
198
|
-
# 'dev': ['check-manifest'],
|
|
199
|
-
# 'test': ['coverage'],
|
|
200
|
-
# },
|
|
201
|
-
|
|
202
|
-
# To provide executable scripts, use entry points in preference to the
|
|
203
|
-
# "scripts" keyword. Entry points provide cross-platform support and allow
|
|
204
|
-
# `pip` to create the appropriate form of executable for the target
|
|
205
|
-
# platform.
|
|
206
|
-
#
|
|
207
|
-
# For example, the following would provide a command called `sample` which
|
|
208
|
-
# executes the function `main` from this package when invoked:
|
|
209
|
-
# entry_points={
|
|
210
|
-
# 'console_scripts': [
|
|
211
|
-
# 'python_module_project=python_module_project:main',
|
|
212
|
-
# ],
|
|
213
|
-
# },
|
|
214
|
-
)
|
|
File without changes
|
|
File without changes
|
{django-light-auth-0.2.2 → django_light_auth-0.2.3}/django_light_auth.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{django-light-auth-0.2.2 → django_light_auth-0.2.3}/django_light_auth.egg-info/top_level.txt
RENAMED
|
File without changes
|