pyobs-auth 2.0.0.dev5__tar.gz → 2.0.0.dev6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pyobs-auth
3
- Version: 2.0.0.dev5
3
+ Version: 2.0.0.dev6
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
@@ -8,6 +8,11 @@ issuer.
8
8
 
9
9
  This class is written to be safe to stack alongside another Bearer-scheme authenticator that
10
10
  can't be modified (e.g. an existing legacy OAuth2 BearerAuthentication) - see below.
11
+
12
+ A resolved user with `is_active=False` is refused - USER_RESOLVER implementations mint new
13
+ accounts inactive by convention, giving each service an independent local activation gate on top
14
+ of whatever access control Keycloak itself does (a kill switch that doesn't depend on Keycloak
15
+ realm/client config alone).
11
16
  """
12
17
 
13
18
  from __future__ import annotations
@@ -50,6 +55,8 @@ class KeycloakAuthentication(authentication.BaseAuthentication):
50
55
  user = user_resolver(claims)
51
56
  if user is None:
52
57
  raise exceptions.AuthenticationFailed("No local user for this token")
58
+ if not user.is_active:
59
+ raise exceptions.AuthenticationFailed("Account pending activation")
53
60
 
54
61
  return (user, claims)
55
62
 
@@ -76,6 +76,8 @@ class CallbackView(View):
76
76
  user = user_resolver(claims)
77
77
  if user is None:
78
78
  return HttpResponseBadRequest("No local user for this token")
79
+ if not user.is_active:
80
+ return HttpResponseBadRequest("Account pending activation")
79
81
 
80
82
  backend = getattr(django_settings, "PYOBS_AUTH_LOGIN_BACKEND", "django.contrib.auth.backends.ModelBackend")
81
83
  login(request, user, backend=backend)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyobs-auth"
3
- version = "2.0.0.dev5"
3
+ version = "2.0.0.dev6"
4
4
  description = "Shared Keycloak/OIDC authentication client for pyobs web services"
5
5
  authors = [{ name = "Tim-Oliver Husser", email = "thusser@uni-goettingen.de" }]
6
6
  requires-python = ">=3.11"
File without changes