diff --git a/auth_oidc/controllers/main.py b/auth_oidc/controllers/main.py index 9475f6620..c0731f0d0 100644 --- a/auth_oidc/controllers/main.py +++ b/auth_oidc/controllers/main.py @@ -10,9 +10,10 @@ from werkzeug.urls import url_decode, url_encode from odoo import http +from odoo.http import request + from odoo.addons.auth_oauth.controllers.main import OAuthLogin from odoo.addons.web.controllers.main import Session -from odoo.http import request _logger = logging.getLogger(__name__) @@ -59,14 +60,24 @@ class OpenIDLogout(Session): def logout(self, redirect="/web/login"): user = request.env["res.users"].sudo().browse(request.session.uid) if user.oauth_provider_id.id: - p = request.env["auth.oauth.provider"].sudo().browse(user.oauth_provider_id.id) + p = ( + request.env["auth.oauth.provider"] + .sudo() + .browse(user.oauth_provider_id.id) + ) if p.logout_endpoint: r = redirect if not r.startswith('http:') and not r.startswith('https:'): r = request.env['ir.config_parameter'].sudo().get_param('web.base.url') + r + r = ( + request.env["ir.config_parameter"] + .sudo() + .get_param("web.base.url") + + r + ) logout_base_url = p.logout_endpoint params = {} - if '?' in p.logout_endpoint: + if "?" in p.logout_endpoint: url_parts = p.logout_endpoint.split("?") logout_base_url = url_parts[0] params = url_decode(url_parts[1]) diff --git a/auth_oidc/models/auth_oauth_provider.py b/auth_oidc/models/auth_oauth_provider.py index afcb9c812..4d2f3e4f5 100644 --- a/auth_oidc/models/auth_oauth_provider.py +++ b/auth_oidc/models/auth_oauth_provider.py @@ -49,7 +49,7 @@ class AuthOauthProvider(models.Model): logout_endpoint = fields.Char( string="Logout URL", help="Required for OpenID Connect to logout the user in the authorization provider upon logout in the client, " - "should be the value of end_session_endpoint specified by the authorization provider" + "should be the value of end_session_endpoint specified by the authorization provider" ) @tools.ormcache("self.jwks_uri", "kid")