Skip to content

Commit

Permalink
Merge pull request #9 from lalithkota/17.0
Browse files Browse the repository at this point in the history
Reverted list_providers_oauth override in controller
  • Loading branch information
shibu-narayanan authored Apr 3, 2024
2 parents 5ae5c8d + 5cbc5d9 commit 38d028f
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions auth_oidc/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,14 @@

from werkzeug.urls import url_decode, url_encode

from odoo.http import request

from odoo.addons.auth_oauth.controllers.main import OAuthLogin

_logger = logging.getLogger(__name__)


class OpenIDLogin(OAuthLogin):
def list_providers_oauth(self, domain=None):
if not domain:
domain = [("enabled", "=", True)]
try:
providers = request.env["auth.oauth.provider"].sudo().search_read(domain)
except Exception:
providers = []
for provider in providers:
return_url = request.httprequest.url_root + "auth_oauth/signin"
state = self.get_state(provider)
params = dict(
response_type="token",
client_id=provider["client_id"],
redirect_uri=return_url,
scope=provider["scope"],
state=json.dumps(state),
# nonce=base64.urlsafe_b64encode(os.urandom(16)),
)
provider["auth_link"] = f"{provider['auth_endpoint']}?{url_encode(params)}"
return providers

def list_providers(self, domain=None):
providers = self.list_providers_oauth(domain)
def list_providers(self):
providers = super().list_providers()
for provider in providers:
flow = provider.get("flow")
if flow in ("id_token", "id_token_code"):
Expand Down

0 comments on commit 38d028f

Please sign in to comment.