Skip to content

Commit

Permalink
Merge pull request #8 from lalithkota/15.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 eed308e + fb1a05e commit cd8010f
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions auth_oidc/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +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"] = "%s?%s" % (
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(OpenIDLogin, self).list_providers()
for provider in providers:
flow = provider.get("flow")
if flow in ("id_token", "id_token_code"):
Expand Down

0 comments on commit cd8010f

Please sign in to comment.