open-api-framework 0.4.2__tar.gz → 0.6.0__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 (26) hide show
  1. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/CHANGELOG.rst +29 -0
  2. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/MANIFEST.in +1 -0
  3. {open_api_framework-0.4.2/open_api_framework.egg-info → open_api_framework-0.6.0}/PKG-INFO +10 -37
  4. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/README.rst +9 -36
  5. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/open_api_framework/conf/base.py +20 -6
  6. open_api_framework-0.6.0/open_api_framework/context_processors.py +14 -0
  7. open_api_framework-0.6.0/open_api_framework/static/open_api_framework/css/admin.css +39 -0
  8. open_api_framework-0.6.0/open_api_framework/templates/open_api_framework/admin/base_site.html +22 -0
  9. open_api_framework-0.6.0/open_api_framework/templates/open_api_framework/components/environment.html +1 -0
  10. open_api_framework-0.6.0/open_api_framework/templates/open_api_framework/components/version.html +5 -0
  11. open_api_framework-0.6.0/open_api_framework/templatetags/__init__.py +0 -0
  12. open_api_framework-0.6.0/open_api_framework/templatetags/open_api_framework.py +19 -0
  13. {open_api_framework-0.4.2 → open_api_framework-0.6.0/open_api_framework.egg-info}/PKG-INFO +10 -37
  14. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/open_api_framework.egg-info/SOURCES.txt +7 -0
  15. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/pyproject.toml +2 -2
  16. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/LICENSE +0 -0
  17. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/open_api_framework/__init__.py +0 -0
  18. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/open_api_framework/apps.py +0 -0
  19. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/open_api_framework/conf/__init__.py +0 -0
  20. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/open_api_framework/conf/utils.py +0 -0
  21. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/open_api_framework/py.typed +0 -0
  22. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/open_api_framework.egg-info/dependency_links.txt +0 -0
  23. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/open_api_framework.egg-info/requires.txt +0 -0
  24. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/open_api_framework.egg-info/top_level.txt +0 -0
  25. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/setup.cfg +0 -0
  26. {open_api_framework-0.4.2 → open_api_framework-0.6.0}/tests/test_config_helpers.py +0 -0
@@ -1,6 +1,35 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 0.6.0 (2024-07-04)
5
+ ------------------
6
+
7
+ **New features**
8
+
9
+ * Use the callback class from mozilla-django-oidc-db to allow for a custom error view
10
+
11
+ 0.5.0 (2024-06-27)
12
+ ------------------
13
+
14
+ **New features**
15
+
16
+ * Add password to ``AXES_SENSITIVE_PARAMETERS``
17
+ * Use stricter ``django-axes`` settings
18
+ * ``AXES_FAILURE_LIMIT`` changed from ``10`` to ``5``
19
+ * ``AXES_COOLOFF_TIME`` changed from ``1`` to ``5`` minutes
20
+ * Make more ``log-outgoing-requests`` settings configurable
21
+ * ``LOG_OUTGOING_REQUESTS_EMIT_BODY`` (default ``True``)
22
+ * ``LOG_OUTGOING_REQUESTS_DB_SAVE_BODY`` (default ``True``)
23
+ * Add base template to display current version in admin
24
+
25
+ **Bugfixes**
26
+
27
+ * Remove FIXTURE_DIRS setting and add root level app to INSTALLED_APPS
28
+
29
+ **Other**
30
+
31
+ * Move documentation to readthedocs
32
+
4
33
  0.4.2 (2024-06-20)
5
34
  ------------------
6
35
 
@@ -4,5 +4,6 @@ include open_api_framework/py.typed
4
4
  recursive-include open_api_framework *.html
5
5
  recursive-include open_api_framework *.txt
6
6
  recursive-include open_api_framework *.po
7
+ recursive-include open_api_framework/static *.css
7
8
  global-exclude __pycache__
8
9
  global-exclude *.py[co]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: open_api_framework
3
- Version: 0.4.2
3
+ Version: 0.6.0
4
4
  Summary: A metapackage for registration components, that bundles the dependencies shared between these components and provides generic settings
5
5
  Author-email: Maykin Media <support@maykinmedia.nl>
6
6
  License: Copyright © Maykin 2024
@@ -77,7 +77,7 @@ Requires-Dist: twine; extra == "release"
77
77
  Open API Framework
78
78
  ==================
79
79
 
80
- :Version: 0.4.2
80
+ :Version: 0.6.0
81
81
  :Source: https://github.com/maykinmedia/open-api-framework
82
82
  :Keywords: metapackage, dependencies
83
83
 
@@ -85,7 +85,8 @@ Open API Framework
85
85
 
86
86
  |python-versions| |django-versions| |pypi-version|
87
87
 
88
- A metapackage for registration components, that bundles the dependencies shared between these components
88
+ A metapackage for registration components, that bundles the dependencies shared between these
89
+ components and provides generic base settings
89
90
 
90
91
  .. contents::
91
92
 
@@ -95,42 +96,12 @@ Features
95
96
  ========
96
97
 
97
98
  * Bundling shared dependencies and introducing minimum versions for these dependencies
99
+ * Providing generic base Django settings to avoid duplicate settings across registration components
98
100
 
99
- Installation
100
- ============
101
+ Usage
102
+ =====
101
103
 
102
- Requirements
103
- ------------
104
-
105
- * Python 3.9 or above
106
- * Django 4.2 or newer
107
-
108
-
109
- Install
110
- -------
111
-
112
- 1. Add open-api-framework to your requirements file
113
- 2. Remove dependencies from your requirements file that occur in ``pyproject.toml``
114
- 3. Recompile the dependencies
115
-
116
- Local development
117
- =================
118
-
119
- To install and develop the library locally, use:
120
-
121
- .. code-block:: bash
122
-
123
- pip install -e .[tests,coverage,docs,release]
124
-
125
- When running management commands via ``django-admin``, make sure to add the root
126
- directory to the python path (or use ``python -m django <command>``):
127
-
128
- .. code-block:: bash
129
-
130
- export PYTHONPATH=. DJANGO_SETTINGS_MODULE=testapp.settings
131
- django-admin check
132
- # or other commands like:
133
- # django-admin makemessages -l nl
104
+ Please see the hosted `documentation`_ for installation, configuration and usage instructions.
134
105
 
135
106
  License
136
107
  =======
@@ -168,3 +139,5 @@ Licensed under the `MIT license`.
168
139
 
169
140
  .. |pypi-version| image:: https://img.shields.io/pypi/v/open-api-framework.svg
170
141
  :target: https://pypi.org/project/open-api-framework/
142
+
143
+ .. _documentation: https://open-api-framework.readthedocs.io/en/latest/
@@ -1,7 +1,7 @@
1
1
  Open API Framework
2
2
  ==================
3
3
 
4
- :Version: 0.4.2
4
+ :Version: 0.6.0
5
5
  :Source: https://github.com/maykinmedia/open-api-framework
6
6
  :Keywords: metapackage, dependencies
7
7
 
@@ -9,7 +9,8 @@ Open API Framework
9
9
 
10
10
  |python-versions| |django-versions| |pypi-version|
11
11
 
12
- A metapackage for registration components, that bundles the dependencies shared between these components
12
+ A metapackage for registration components, that bundles the dependencies shared between these
13
+ components and provides generic base settings
13
14
 
14
15
  .. contents::
15
16
 
@@ -19,42 +20,12 @@ Features
19
20
  ========
20
21
 
21
22
  * Bundling shared dependencies and introducing minimum versions for these dependencies
23
+ * Providing generic base Django settings to avoid duplicate settings across registration components
22
24
 
23
- Installation
24
- ============
25
+ Usage
26
+ =====
25
27
 
26
- Requirements
27
- ------------
28
-
29
- * Python 3.9 or above
30
- * Django 4.2 or newer
31
-
32
-
33
- Install
34
- -------
35
-
36
- 1. Add open-api-framework to your requirements file
37
- 2. Remove dependencies from your requirements file that occur in ``pyproject.toml``
38
- 3. Recompile the dependencies
39
-
40
- Local development
41
- =================
42
-
43
- To install and develop the library locally, use:
44
-
45
- .. code-block:: bash
46
-
47
- pip install -e .[tests,coverage,docs,release]
48
-
49
- When running management commands via ``django-admin``, make sure to add the root
50
- directory to the python path (or use ``python -m django <command>``):
51
-
52
- .. code-block:: bash
53
-
54
- export PYTHONPATH=. DJANGO_SETTINGS_MODULE=testapp.settings
55
- django-admin check
56
- # or other commands like:
57
- # django-admin makemessages -l nl
28
+ Please see the hosted `documentation`_ for installation, configuration and usage instructions.
58
29
 
59
30
  License
60
31
  =======
@@ -92,3 +63,5 @@ Licensed under the `MIT license`.
92
63
 
93
64
  .. |pypi-version| image:: https://img.shields.io/pypi/v/open-api-framework.svg
94
65
  :target: https://pypi.org/project/open-api-framework/
66
+
67
+ .. _documentation: https://open-api-framework.readthedocs.io/en/latest/
@@ -1,3 +1,4 @@
1
+ import datetime
1
2
  import os
2
3
  import warnings
3
4
  from pathlib import Path
@@ -145,6 +146,8 @@ INSTALLED_APPS = [
145
146
  "mozilla_django_oidc_db",
146
147
  "log_outgoing_requests",
147
148
  "django_setup_configuration",
149
+ "open_api_framework",
150
+ PROJECT_DIRNAME,
148
151
  ]
149
152
 
150
153
  MIDDLEWARE = [
@@ -180,6 +183,7 @@ TEMPLATES = [
180
183
  "django.template.context_processors.request",
181
184
  "django.contrib.auth.context_processors.auth",
182
185
  "django.contrib.messages.context_processors.messages",
186
+ "open_api_framework.context_processors.admin_settings",
183
187
  f"{PROJECT_DIRNAME}.utils.context_processors.settings",
184
188
  ],
185
189
  "loaders": TEMPLATE_LOADERS,
@@ -216,8 +220,6 @@ MEDIA_URL = "/media/"
216
220
 
217
221
  FILE_UPLOAD_PERMISSIONS = 0o644
218
222
 
219
- FIXTURE_DIRS = (Path(DJANGO_PROJECT_DIR) / "fixtures",)
220
-
221
223
  #
222
224
  # Sending EMAIL
223
225
  #
@@ -480,11 +482,12 @@ NUM_PROXIES = config( # TODO: this also is relevant for DRF settings if/when we
480
482
  AXES_CACHE = "axes" # refers to CACHES setting
481
483
  # The number of login attempts allowed before a record is created for the
482
484
  # failed logins. Default: 3
483
- AXES_FAILURE_LIMIT = 10
485
+ AXES_FAILURE_LIMIT = 5
486
+ AXES_LOCK_OUT_AT_FAILURE = True # Default: True
484
487
  # If set, defines a period of inactivity after which old failed login attempts
485
488
  # will be forgotten. Can be set to a python timedelta object or an integer. If
486
489
  # an integer, will be interpreted as a number of hours. Default: None
487
- AXES_COOLOFF_TIME = 1
490
+ AXES_COOLOFF_TIME = datetime.timedelta(minutes=5)
488
491
  # The number of reverse proxies
489
492
  AXES_IPWARE_PROXY_COUNT = NUM_PROXIES - 1 if NUM_PROXIES else None
490
493
  # If set, specifies a template to render when a user is locked out. Template
@@ -494,7 +497,7 @@ AXES_LOCKOUT_PARAMETERS = [["ip_address", "user_agent", "username"]]
494
497
  AXES_BEHIND_REVERSE_PROXY = IS_HTTPS
495
498
  # By default, Axes obfuscates values for formfields named "password", but the admin
496
499
  # interface login formfield name is "auth-password", so we want to obfuscate that
497
- AXES_SENSITIVE_PARAMETERS = ["auth-password"] # nosec
500
+ AXES_SENSITIVE_PARAMETERS = ["password", "auth-password"] # nosec
498
501
 
499
502
  # The default meta precedence order
500
503
  IPWARE_META_PRECEDENCE_ORDER = (
@@ -598,6 +601,10 @@ ADMIN_INDEX_AUTO_CREATE_APP_GROUP = False
598
601
  # Mozilla Django OIDC DB settings
599
602
  #
600
603
  OIDC_AUTHENTICATE_CLASS = "mozilla_django_oidc_db.views.OIDCAuthenticationRequestView"
604
+ # Use custom callback view to handle admin login error situations
605
+ # NOTE the AdminLoginFailure view for mozilla-django-oidc-db should be added to the projects
606
+ # urlpatterns to properly catch errors
607
+ OIDC_CALLBACK_CLASS = "mozilla_django_oidc_db.views.OIDCCallbackView"
601
608
  MOZILLA_DJANGO_OIDC_DB_CACHE = "oidc"
602
609
  MOZILLA_DJANGO_OIDC_DB_CACHE_TIMEOUT = 5 * 60
603
610
 
@@ -643,6 +650,8 @@ MAYKIN_2FA_ALLOW_MFA_BYPASS_BACKENDS = [
643
650
  "mozilla_django_oidc_db.backends.OIDCAuthenticationBackend",
644
651
  ]
645
652
 
653
+ # if DISABLE_2FA is true, fill the MAYKIN_2FA_ALLOW_MFA_BYPASS_BACKENDS with all
654
+ # configured AUTHENTICATION_BACKENDS and thus disabeling the entire 2FA chain.
646
655
  if config("DISABLE_2FA", default=False): # pragma: no cover
647
656
  MAYKIN_2FA_ALLOW_MFA_BYPASS_BACKENDS = AUTHENTICATION_BACKENDS
648
657
 
@@ -650,7 +659,12 @@ if config("DISABLE_2FA", default=False): # pragma: no cover
650
659
  #
651
660
  # LOG OUTGOING REQUESTS
652
661
  #
653
- LOG_OUTGOING_REQUESTS_EMIT_BODY = True
662
+ LOG_OUTGOING_REQUESTS_EMIT_BODY = config(
663
+ "LOG_OUTGOING_REQUESTS_EMIT_BODY", default=True
664
+ )
665
+ LOG_OUTGOING_REQUESTS_DB_SAVE_BODY = config(
666
+ "LOG_OUTGOING_REQUESTS_DB_SAVE_BODY", default=True
667
+ )
654
668
  LOG_OUTGOING_REQUESTS_DB_SAVE = config("LOG_OUTGOING_REQUESTS_DB_SAVE", default=False)
655
669
  LOG_OUTGOING_REQUESTS_RESET_DB_SAVE_AFTER = None
656
670
  LOG_OUTGOING_REQUESTS_MAX_AGE = config(
@@ -0,0 +1,14 @@
1
+ from django.conf import settings
2
+ from django.http.request import HttpRequest
3
+
4
+
5
+ def admin_settings(request: HttpRequest) -> dict:
6
+ show_version = request.user.is_staff
7
+
8
+ return {
9
+ "show_environment": getattr(settings, "ENVIRONMENT_SHOWN_IN_ADMIN", None),
10
+ "show_version": show_version,
11
+ "git_sha": getattr(settings, "GIT_SHA", None),
12
+ "version": getattr(settings, "RELEASE", None),
13
+ "environment": getattr(settings, "ENVIRONMENT", None),
14
+ }
@@ -0,0 +1,39 @@
1
+ :root {
2
+ --version-fg: #c2c2c2;
3
+ --version-padding: 0 30px;
4
+ --version-font-size: smaller;
5
+
6
+ --env-button-bg: #333;
7
+ --env-button-fg: #f3f3f3;
8
+ --env-button-height: 35px;
9
+ --env-button-width: 300px;
10
+ --env-button-line-height: 35px;
11
+ }
12
+
13
+ .login .version {
14
+ text-align: center;
15
+ }
16
+
17
+ .version {
18
+ padding: var(--version-padding);
19
+ color: var(--version-fg);
20
+ font-size: var(--version-font-size);
21
+ }
22
+
23
+ .env {
24
+ display: block;
25
+ line-height: var(--env-button-line-height);
26
+ text-align: center;
27
+ font-weight: bold;
28
+ text-transform: uppercase;
29
+ color: var(--env-button-fg);
30
+ background-color: var(--env-button-bg);
31
+ position: fixed;
32
+ top: 0;
33
+ height: var(--env-button-height);
34
+ width: var(--env-button-width);
35
+ left: 50%;
36
+ margin-left: -150px;
37
+ z-index: 1000001;
38
+ box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2);
39
+ }
@@ -0,0 +1,22 @@
1
+ {% extends "admin/base.html" %}
2
+ {% load static open_api_framework %}
3
+
4
+ {% block extrastyle %}
5
+ <link rel="stylesheet" type="text/css" href="{% static 'open_api_framework/css/admin.css' %}">
6
+ {% endblock %}
7
+
8
+ {% block messages %}
9
+ {% if show_environment %}
10
+ {% environment %}
11
+ {% endif %}
12
+
13
+ {{ block.super }}
14
+ {% endblock %}
15
+
16
+ {% block footer %}
17
+ <div id="footer">
18
+ {% if show_version %}
19
+ {% version %}
20
+ {% endif %}
21
+ </div>
22
+ {% endblock %}
@@ -0,0 +1 @@
1
+ <div class="env env-{{ environment }}">{{ environment }}</div>
@@ -0,0 +1,5 @@
1
+ {% load i18n %}
2
+
3
+ <div class="version" title="Git SHA: {{ git_sha }}">
4
+ {% trans "Version" %} {{ version }}
5
+ </div>
@@ -0,0 +1,19 @@
1
+ from django import template
2
+ from django.conf import settings
3
+
4
+ register = template.Library()
5
+
6
+
7
+ @register.inclusion_tag("open_api_framework/components/version.html")
8
+ def version() -> dict:
9
+ return {
10
+ "version": getattr(settings, "RELEASE", ""),
11
+ "git_sha": getattr(settings, "GIT_SHA", ""),
12
+ }
13
+
14
+
15
+ @register.inclusion_tag("open_api_framework/components/environment.html")
16
+ def environment() -> dict:
17
+ return {
18
+ "environment": getattr(settings, "ENVIRONMENT", ""),
19
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: open_api_framework
3
- Version: 0.4.2
3
+ Version: 0.6.0
4
4
  Summary: A metapackage for registration components, that bundles the dependencies shared between these components and provides generic settings
5
5
  Author-email: Maykin Media <support@maykinmedia.nl>
6
6
  License: Copyright © Maykin 2024
@@ -77,7 +77,7 @@ Requires-Dist: twine; extra == "release"
77
77
  Open API Framework
78
78
  ==================
79
79
 
80
- :Version: 0.4.2
80
+ :Version: 0.6.0
81
81
  :Source: https://github.com/maykinmedia/open-api-framework
82
82
  :Keywords: metapackage, dependencies
83
83
 
@@ -85,7 +85,8 @@ Open API Framework
85
85
 
86
86
  |python-versions| |django-versions| |pypi-version|
87
87
 
88
- A metapackage for registration components, that bundles the dependencies shared between these components
88
+ A metapackage for registration components, that bundles the dependencies shared between these
89
+ components and provides generic base settings
89
90
 
90
91
  .. contents::
91
92
 
@@ -95,42 +96,12 @@ Features
95
96
  ========
96
97
 
97
98
  * Bundling shared dependencies and introducing minimum versions for these dependencies
99
+ * Providing generic base Django settings to avoid duplicate settings across registration components
98
100
 
99
- Installation
100
- ============
101
+ Usage
102
+ =====
101
103
 
102
- Requirements
103
- ------------
104
-
105
- * Python 3.9 or above
106
- * Django 4.2 or newer
107
-
108
-
109
- Install
110
- -------
111
-
112
- 1. Add open-api-framework to your requirements file
113
- 2. Remove dependencies from your requirements file that occur in ``pyproject.toml``
114
- 3. Recompile the dependencies
115
-
116
- Local development
117
- =================
118
-
119
- To install and develop the library locally, use:
120
-
121
- .. code-block:: bash
122
-
123
- pip install -e .[tests,coverage,docs,release]
124
-
125
- When running management commands via ``django-admin``, make sure to add the root
126
- directory to the python path (or use ``python -m django <command>``):
127
-
128
- .. code-block:: bash
129
-
130
- export PYTHONPATH=. DJANGO_SETTINGS_MODULE=testapp.settings
131
- django-admin check
132
- # or other commands like:
133
- # django-admin makemessages -l nl
104
+ Please see the hosted `documentation`_ for installation, configuration and usage instructions.
134
105
 
135
106
  License
136
107
  =======
@@ -168,3 +139,5 @@ Licensed under the `MIT license`.
168
139
 
169
140
  .. |pypi-version| image:: https://img.shields.io/pypi/v/open-api-framework.svg
170
141
  :target: https://pypi.org/project/open-api-framework/
142
+
143
+ .. _documentation: https://open-api-framework.readthedocs.io/en/latest/
@@ -6,6 +6,7 @@ pyproject.toml
6
6
  setup.cfg
7
7
  open_api_framework/__init__.py
8
8
  open_api_framework/apps.py
9
+ open_api_framework/context_processors.py
9
10
  open_api_framework/py.typed
10
11
  open_api_framework.egg-info/PKG-INFO
11
12
  open_api_framework.egg-info/SOURCES.txt
@@ -15,4 +16,10 @@ open_api_framework.egg-info/top_level.txt
15
16
  open_api_framework/conf/__init__.py
16
17
  open_api_framework/conf/base.py
17
18
  open_api_framework/conf/utils.py
19
+ open_api_framework/static/open_api_framework/css/admin.css
20
+ open_api_framework/templates/open_api_framework/admin/base_site.html
21
+ open_api_framework/templates/open_api_framework/components/environment.html
22
+ open_api_framework/templates/open_api_framework/components/version.html
23
+ open_api_framework/templatetags/__init__.py
24
+ open_api_framework/templatetags/open_api_framework.py
18
25
  tests/test_config_helpers.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "open_api_framework"
7
- version = "0.4.2"
7
+ version = "0.6.0"
8
8
  description = "A metapackage for registration components, that bundles the dependencies shared between these components and provides generic settings"
9
9
  authors = [
10
10
  {name = "Maykin Media", email = "support@maykinmedia.nl"}
@@ -100,7 +100,7 @@ testpaths = ["tests"]
100
100
  DJANGO_SETTINGS_MODULE = "testapp.settings"
101
101
 
102
102
  [tool.bumpversion]
103
- current_version = "0.4.2"
103
+ current_version = "0.6.0"
104
104
  files = [
105
105
  {filename = "pyproject.toml"},
106
106
  {filename = "README.rst"},