Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions auth_saml/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from odoo.addons.web.controllers.main import (
Home,
Session as WebSession,
ensure_db,
login_and_redirect,
set_cookie_and_redirect,
Expand Down Expand Up @@ -270,3 +271,20 @@ def saml_metadata(self, req, **kw):
),
[("Content-Type", "text/xml")],
)


class Session(WebSession):
@http.route("/web/session/logout", type="http", auth="none")
def logout(self, redirect="/web/login"):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if I should not just say

Suggested change
def logout(self, redirect="/web/login"):
def logout(self, redirect="/web/login?disable_autoredirect="):

and simply return super().logout(redirect)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello @gurneyalex , reading the doc https://github.com/OCA/server-auth/blob/15.0/auth_saml/README.rst#configuration I think we could try to test it and have an answer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried this variant, seems we have the same expected result

# make sure that when a user logs out, he does not get immediately
# relogged in if autoredirect is enabled, so that they get an
# opportunity to authenticate with a normal password and get access
# e.g. to the admin account.
if "disable_autoredirect" not in redirect:
path, sep, parameters = redirect.partition("?")
if parameters:
parameters += "&disable_autoredirect="
else:
parameters = "disable_autoredirect="
redirect = path + "?" + parameters
return super().logout(redirect=redirect)