pyobs-auth 2.0.0.dev0__py3-none-any.whl → 2.0.0.dev2__py3-none-any.whl

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.
@@ -5,6 +5,9 @@ support here. See pyobs-core's shared-auth design doc for why: any upstream iden
5
5
  (including a self-hosted observation-portal) is meant to be brokered *behind* Keycloak, not
6
6
  validated directly by this class, so archive/robotic-backend/etc. only ever need to trust one
7
7
  issuer.
8
+
9
+ This class is written to be safe to stack alongside another Bearer-scheme authenticator that
10
+ can't be modified (e.g. an existing legacy OAuth2 BearerAuthentication) - see below.
8
11
  """
9
12
 
10
13
  from __future__ import annotations
@@ -29,6 +32,15 @@ class KeycloakAuthentication(authentication.BaseAuthentication):
29
32
  settings = get_settings()
30
33
  validator = TokenValidator(settings)
31
34
 
35
+ # DRF stops the whole authenticator chain on a raise, unlike a `None` return, which just
36
+ # falls through to the next class. If another Bearer-scheme authenticator is also
37
+ # registered (e.g. a legacy OAuth2 BearerAuthentication that can't be modified to do the
38
+ # same check), a token that was never meant for us must not block it from getting a turn -
39
+ # so defer (return None) for anything that doesn't even claim to be from our issuer, and
40
+ # only raise once we know the token was meant for us but is actually invalid.
41
+ if validator.unverified_issuer(token) != settings.issuer:
42
+ return None
43
+
32
44
  try:
33
45
  claims = validator.validate(token)
34
46
  except TokenValidationError as exc:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pyobs-auth
3
- Version: 2.0.0.dev0
3
+ Version: 2.0.0.dev2
4
4
  Summary: Shared Keycloak/OIDC authentication client for pyobs web services
5
5
  Author-email: Tim-Oliver Husser <thusser@uni-goettingen.de>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  pyobs_auth/__init__.py,sha256=vCI7zULdAAll7fiHPhxlra7xfwbPvPAZwtITHExPYn8,280
2
2
  pyobs_auth/apps.py,sha256=gWeEqL9TK3x6owVKHbnUujttu3Nt-qGcquQC7wLb4nY,151
3
- pyobs_auth/authentication.py,sha256=ejjWWvg39COSUVRxyTX0pOpOYjZSyNNzJ3_0Npk03nY,1708
3
+ pyobs_auth/authentication.py,sha256=H1CCorVntY4yxwjBuUIkm6UuoFbVWjqSGI1P2rp9YGo,2544
4
4
  pyobs_auth/client.py,sha256=6WltZrcnJNahwpProomt-q4cDeaq5VRhnerEiTGg61Q,4648
5
5
  pyobs_auth/discovery.py,sha256=a7d6uqA8ebMHrRrfy-pHNvyP_RRAO87UOuAryiKiico,1360
6
6
  pyobs_auth/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,7 +8,7 @@ pyobs_auth/settings.py,sha256=MhHnhsdrlhpLzC7GhVjQEaMhxKz6aDeUFju1J5ieJjM,3051
8
8
  pyobs_auth/urls.py,sha256=6fMyNdX7jDyl-wVUXAyUG4HjJngrfR_rk9i2PKt0lGA,236
9
9
  pyobs_auth/validation.py,sha256=cOuG6kl4_O03BWACJZfhsPLuEYQvj36FxBYk-adneyI,2673
10
10
  pyobs_auth/views.py,sha256=euZ433EcO0mrBoTCmCbRHCrKmbyR0bV1HvIVa6V8lxA,3123
11
- pyobs_auth-2.0.0.dev0.dist-info/METADATA,sha256=a13okJuEHBtqPzenRZz7ZPFDDAvEP2FNjgN7r0D7xAg,410
12
- pyobs_auth-2.0.0.dev0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
13
- pyobs_auth-2.0.0.dev0.dist-info/licenses/LICENSE,sha256=Gi2yBbEZraESTIWbTnc4elzshQaXpW4QBs9FBotLG7A,1099
14
- pyobs_auth-2.0.0.dev0.dist-info/RECORD,,
11
+ pyobs_auth-2.0.0.dev2.dist-info/METADATA,sha256=yyxN-cJzX7ZddMMHgL5TKp2phwQtWgPupNpIzUAWhSw,410
12
+ pyobs_auth-2.0.0.dev2.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
13
+ pyobs_auth-2.0.0.dev2.dist-info/licenses/LICENSE,sha256=Gi2yBbEZraESTIWbTnc4elzshQaXpW4QBs9FBotLG7A,1099
14
+ pyobs_auth-2.0.0.dev2.dist-info/RECORD,,