pyobs-auth 2.0.0.dev2__tar.gz → 2.0.0.dev3__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.dev2
3
+ Version: 2.0.0.dev3
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
@@ -29,7 +29,9 @@ class LoginView(View):
29
29
 
30
30
  request.session[SESSION_STATE_KEY] = authorization.state
31
31
  request.session[SESSION_CODE_VERIFIER_KEY] = authorization.code_verifier
32
- request.session[SESSION_NEXT_KEY] = request.GET.get("next", "/")
32
+ # `or "/"` (not just a dict default) because `?next=` with an empty value is a present-but-
33
+ # falsy key - `.get("next", "/")` alone would return "" instead of falling back to "/".
34
+ request.session[SESSION_NEXT_KEY] = request.GET.get("next") or "/"
33
35
 
34
36
  return HttpResponseRedirect(authorization.url)
35
37
 
@@ -44,7 +46,7 @@ class CallbackView(View):
44
46
  state = request.GET.get("state")
45
47
  expected_state = request.session.pop(SESSION_STATE_KEY, None)
46
48
  code_verifier = request.session.pop(SESSION_CODE_VERIFIER_KEY, None)
47
- next_url = request.session.pop(SESSION_NEXT_KEY, "/")
49
+ next_url = request.session.pop(SESSION_NEXT_KEY, "/") or "/"
48
50
 
49
51
  if not code or not state or not code_verifier or state != expected_state:
50
52
  return HttpResponseBadRequest("Invalid or expired login state")
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyobs-auth"
3
- version = "2.0.0.dev2"
3
+ version = "2.0.0.dev3"
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