Skip to content

Commit

Permalink
Apply formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wluyima committed Jun 18, 2024
1 parent 6bd6a6b commit bb1603f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions auth_oidc/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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 = (

Check warning on line 63 in auth_oidc/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

auth_oidc/controllers/main.py#L63

Added line #L63 was not covered by tests
request.env["auth.oauth.provider"]
.sudo()
.browse(user.oauth_provider_id.id)
)
if p.logout_endpoint:
r = redirect

Check warning on line 69 in auth_oidc/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

auth_oidc/controllers/main.py#L69

Added line #L69 was not covered by tests
if not r.startswith('http:') and not r.startswith('https:'):
r = request.env['ir.config_parameter'].sudo().get_param('web.base.url') + r
r = (

Check warning on line 72 in auth_oidc/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

auth_oidc/controllers/main.py#L71-L72

Added lines #L71 - L72 were not covered by tests
request.env["ir.config_parameter"]
.sudo()
.get_param("web.base.url")
+ r
)
logout_base_url = p.logout_endpoint
params = {}

Check warning on line 79 in auth_oidc/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

auth_oidc/controllers/main.py#L78-L79

Added lines #L78 - L79 were not covered by tests
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])
Expand Down
2 changes: 1 addition & 1 deletion auth_oidc/models/auth_oauth_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit bb1603f

Please sign in to comment.