Skip to content

Commit

Permalink
Applied auto format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wluyima committed Oct 10, 2024
1 parent 48cf47a commit adc81ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
9 changes: 6 additions & 3 deletions auth_oidc/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging

import requests

from odoo import api, fields, models
from odoo.exceptions import AccessDenied
from odoo.http import request
Expand All @@ -15,7 +16,7 @@
class ResUsers(models.Model):
_inherit = "res.users"

oauth_id_token = fields.Char(string='OAuth Id Token', readonly=True, copy=False)
oauth_id_token = fields.Char(string="OAuth Id Token", readonly=True, copy=False)

def _auth_oauth_get_tokens_implicit_flow(self, oauth_provider, params):
# https://openid.net/specs/openid-connect-core-1_0.html#ImplicitAuthResponse
Expand Down Expand Up @@ -77,8 +78,10 @@ def auth_oauth(self, provider, params):
params["access_token"] = access_token
params["id_token"] = id_token
login = self._auth_oauth_signin(provider, validation, params)
oauth_user = self.search([("login", "=", login), ('oauth_access_token', '=', access_token)])
oauth_user.write({'oauth_id_token': params['id_token']})
oauth_user = self.search(
[("login", "=", login), ("oauth_access_token", "=", access_token)]
)
oauth_user.write({"oauth_id_token": params["id_token"]})
if not login:
raise AccessDenied()
# return user credentials
Expand Down
12 changes: 7 additions & 5 deletions auth_oidc/tests/test_auth_oidc_logout.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import logging
from urllib.parse import parse_qsl, urljoin, urlparse

from werkzeug.urls import url_encode

import odoo
from odoo.addons.website.tools import MockRequest
from odoo.tests import common
from odoo.tools.misc import DotDict
from werkzeug.urls import url_encode

from odoo.addons.website.tools import MockRequest

from ..controllers.main import OpenIDLogout

Expand Down Expand Up @@ -129,7 +131,7 @@ def test_oidc_logout_with_absolute_redirect_url(self):

def test_oidc_logout_skip_confirmation(self):
"""Test that oidc logout skips confirmation"""
id_token = 'test-id-token'
id_token = "test-id-token"
self._set_test_oidc_logout_url(urljoin(OIDC_BASE_LOGOUT_URL, OIDC_LOGOUT_PATH))
self.provider.write({"skip_logout_confirmation": True})
user = self._prepare_login_test_user(self.provider)
Expand All @@ -148,7 +150,7 @@ def test_oidc_logout_skip_confirmation(self):

def test_oidc_logout_not_skip_confirmation_if_no_id_token(self):
"""Test that oidc logout does not skip confirmation if user has no oauth_id_token"""
id_token = 'test-id-token'
id_token = "test-id-token"
self._set_test_oidc_logout_url(urljoin(OIDC_BASE_LOGOUT_URL, OIDC_LOGOUT_PATH))
self.provider.write({"skip_logout_confirmation": True})
user = self._prepare_login_test_user(self.provider)
Expand All @@ -166,7 +168,7 @@ def test_oidc_logout_not_skip_confirmation_if_no_id_token(self):

def test_oidc_logout_not_skip_confirmation_if_not_enabled(self):
"""Test that oidc logout skips confirmation"""
id_token = 'test-id-token'
id_token = "test-id-token"
self._set_test_oidc_logout_url(urljoin(OIDC_BASE_LOGOUT_URL, OIDC_LOGOUT_PATH))
self.provider.write({"skip_logout_confirmation": False})
user = self._prepare_login_test_user(self.provider)
Expand Down

0 comments on commit adc81ad

Please sign in to comment.