plain.oauth 0.30.0__tar.gz → 0.31.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 (41) hide show
  1. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/PKG-INFO +1 -1
  2. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/CHANGELOG.md +11 -0
  3. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/models.py +1 -37
  4. plain_oauth-0.31.0/plain/oauth/preflight.py +38 -0
  5. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/pyproject.toml +1 -1
  6. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/test_checks.py +5 -2
  7. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/.gitignore +0 -0
  8. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/LICENSE +0 -0
  9. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/README.md +0 -0
  10. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/README.md +0 -0
  11. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/__init__.py +0 -0
  12. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/admin.py +0 -0
  13. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/config.py +0 -0
  14. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/default_settings.py +0 -0
  15. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/exceptions.py +0 -0
  16. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/migrations/0001_initial.py +0 -0
  17. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/migrations/__init__.py +0 -0
  18. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/providers.py +0 -0
  19. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/templates/oauth/callback.html +0 -0
  20. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/urls.py +0 -0
  21. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/plain/oauth/views.py +0 -0
  22. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/provider_examples/__init__.py +0 -0
  23. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/provider_examples/bitbucket.py +0 -0
  24. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/provider_examples/github.py +0 -0
  25. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/provider_examples/gitlab.py +0 -0
  26. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/app/settings.py +0 -0
  27. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/app/templates/base.html +0 -0
  28. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/app/templates/index.html +0 -0
  29. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/app/templates/login.html +0 -0
  30. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/app/urls.py +0 -0
  31. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/app/users/migrations/0001_initial.py +0 -0
  32. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/app/users/migrations/__init__.py +0 -0
  33. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/app/users/models.py +0 -0
  34. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/provider_tests/__init__.py +0 -0
  35. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/provider_tests/test_github.py +0 -0
  36. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/providers/__init__.py +0 -0
  37. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/providers/bitbucket.py +0 -0
  38. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/providers/github.py +0 -0
  39. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/providers/gitlab.py +0 -0
  40. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/test_backends.py +0 -0
  41. {plain_oauth-0.30.0 → plain_oauth-0.31.0}/tests/test_providers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.oauth
3
- Version: 0.30.0
3
+ Version: 0.31.0
4
4
  Summary: Let users log in with OAuth providers.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -1,5 +1,16 @@
1
1
  # plain-oauth changelog
2
2
 
3
+ ## [0.31.0](https://github.com/dropseed/plain/releases/plain-oauth@0.31.0) (2025-10-12)
4
+
5
+ ### What's changed
6
+
7
+ - Preflight provider key check has been moved from the model to a standalone `CheckOAuthProviderKeys` preflight check class ([fdc5aee](https://github.com/dropseed/plain/commit/fdc5aee))
8
+ - Preflight check ID has been renamed from `oauth.provider_in_db_not_in_settings` to `oauth.provider_settings_missing` ([fdc5aee](https://github.com/dropseed/plain/commit/fdc5aee))
9
+
10
+ ### Upgrade instructions
11
+
12
+ - No changes required
13
+
3
14
  ## [0.30.0](https://github.com/dropseed/plain/releases/plain-oauth@0.30.0) (2025-10-07)
4
15
 
5
16
  ### What's changed
@@ -4,8 +4,7 @@ from plain import models
4
4
  from plain.auth import get_user_model
5
5
  from plain.exceptions import ValidationError
6
6
  from plain.models import transaction
7
- from plain.models.db import IntegrityError, OperationalError, ProgrammingError
8
- from plain.preflight import PreflightResult
7
+ from plain.models.db import IntegrityError
9
8
  from plain.runtime import SettingsReference
10
9
  from plain.utils import timezone
11
10
 
@@ -15,9 +14,6 @@ if TYPE_CHECKING:
15
14
  from .providers import OAuthToken, OAuthUser
16
15
 
17
16
 
18
- # TODO preflight check for deploy that ensures all provider keys in db are also in settings?
19
-
20
-
21
17
  @models.register_model
22
18
  class OAuthConnection(models.Model):
23
19
  created_at = models.DateTimeField(auto_now_add=True)
@@ -154,35 +150,3 @@ class OAuthConnection(models.Model):
154
150
  connection.save()
155
151
 
156
152
  return connection
157
-
158
- @classmethod
159
- def preflight(cls) -> list[PreflightResult]:
160
- """
161
- A system check for ensuring that provider_keys in the database are also present in settings.
162
- """
163
- errors = super().preflight()
164
-
165
- from .providers import get_provider_keys
166
-
167
- try:
168
- keys_in_db = set(
169
- cls.query.values_list("provider_key", flat=True).distinct()
170
- )
171
- except (OperationalError, ProgrammingError):
172
- # Check runs on plain migrate, and the table may not exist yet
173
- # or it may not be installed on the particular database intentionally
174
- return errors
175
-
176
- keys_in_settings = set(get_provider_keys())
177
-
178
- if keys_in_db - keys_in_settings:
179
- errors.append(
180
- PreflightResult(
181
- fix="The following OAuth providers are in the database but not in the settings: {}. Add these providers to your OAUTH_LOGIN_PROVIDERS setting or remove the corresponding OAuthConnection records.".format(
182
- ", ".join(keys_in_db - keys_in_settings)
183
- ),
184
- id="oauth.provider_in_db_not_in_settings",
185
- )
186
- )
187
-
188
- return errors
@@ -0,0 +1,38 @@
1
+ from plain.models import OperationalError, ProgrammingError
2
+ from plain.preflight import PreflightCheck, PreflightResult, register_check
3
+
4
+
5
+ @register_check(name="oauth.provider_keys")
6
+ class CheckOAuthProviderKeys(PreflightCheck):
7
+ """
8
+ Check for OAuth provider keys in the database that are not present in settings.
9
+ """
10
+
11
+ def run(self) -> list[PreflightResult]:
12
+ from .models import OAuthConnection
13
+ from .providers import get_provider_keys
14
+
15
+ errors = []
16
+
17
+ try:
18
+ keys_in_db = set(
19
+ OAuthConnection.query.values_list("provider_key", flat=True).distinct()
20
+ )
21
+ except (OperationalError, ProgrammingError):
22
+ # Check runs on plain migrate, and the table may not exist yet
23
+ # or it may not be installed on the particular database intentionally
24
+ return errors
25
+
26
+ keys_in_settings = set(get_provider_keys())
27
+
28
+ if keys_in_db - keys_in_settings:
29
+ errors.append(
30
+ PreflightResult(
31
+ fix="The following OAuth providers are in the database but not in the settings: {}. Add these providers to your OAUTH_LOGIN_PROVIDERS setting or remove the corresponding OAuthConnection records.".format(
32
+ ", ".join(keys_in_db - keys_in_settings)
33
+ ),
34
+ id="oauth.provider_settings_missing",
35
+ )
36
+ )
37
+
38
+ return errors
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "plain.oauth"
3
- version = "0.30.0"
3
+ version = "0.31.0"
4
4
  description = "Let users log in with OAuth providers."
5
5
  authors = [{name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev"}]
6
6
  license = "BSD-3-Clause"
@@ -1,5 +1,6 @@
1
1
  from plain.auth import get_user_model
2
2
  from plain.oauth.models import OAuthConnection
3
+ from plain.oauth.preflight import CheckOAuthProviderKeys
3
4
 
4
5
 
5
6
  def test_oauth_provider_keys_check_pass(db, settings):
@@ -23,7 +24,8 @@ def test_oauth_provider_keys_check_pass(db, settings):
23
24
  access_token="test",
24
25
  )
25
26
 
26
- errors = OAuthConnection.preflight()
27
+ check = CheckOAuthProviderKeys()
28
+ errors = check.run()
27
29
  assert len(errors) == 0
28
30
 
29
31
 
@@ -54,7 +56,8 @@ def test_oauth_provider_keys_check_fail(db, settings):
54
56
  access_token="test",
55
57
  )
56
58
 
57
- errors = OAuthConnection.preflight()
59
+ check = CheckOAuthProviderKeys()
60
+ errors = check.run()
58
61
  assert len(errors) == 1
59
62
  assert (
60
63
  errors[0].fix
File without changes
File without changes
File without changes