Skip to content

Commit 9243b43

Browse files
committed
Fix settings management : uri names where mixed with uri paths
1 parent 51cd2e4 commit 9243b43

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

django_pyoidc/settings.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -164,26 +164,19 @@ def _fix_settings(self, op_definition: Dict[str, Any]) -> Dict[str, Any]:
164164
# is a better way to define callback path.
165165
# here this will only work when no route prefix is used.
166166

167-
# remove '/' prefix if any."
168-
if op_definition["oidc_paths_prefix"][:1] == "/":
169-
op_definition["oidc_paths_prefix"] = op_definition["oidc_paths_prefix"][
170-
1:
171-
]
172-
173167
if "oidc_callback_path" not in op_definition:
174-
op_definition["oidc_callback_path"] = (
168+
op_definition["oidc_callback_path"] = reverse_lazy(
175169
f"{op_definition['oidc_paths_prefix']}-callback"
176170
)
177171

178172
if "oidc_callback_path" in op_definition:
179173
# remove '/' prefix if any.
180-
if op_definition["oidc_callback_path"][:1] == "/":
181-
op_definition["oidc_callback_path"] = op_definition[
182-
"oidc_callback_path"
183-
][1:]
174+
op_definition["oidc_callback_path"] = op_definition[
175+
"oidc_callback_path"
176+
].lstrip("/")
184177

185178
# else: do not set defaults.
186-
# The Provider object should have defined a defaut callback path part and default
179+
# The Provider object should have defined a default callback path part and default
187180
# callback path.
188181

189182
if "callback_uri_name" in op_definition:
@@ -271,6 +264,7 @@ def get(
271264
return default
272265
return res
273266

267+
@property
274268
def provider(self) -> Provider:
275269
return self._provider
276270

0 commit comments

Comments
 (0)