Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverted list_providers_oauth override in controller #9

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading