Maintainers
+Maintainers
This module is maintained by the OCA.
@@ -608,6 +605,5 @@ diff --git a/auth_oidc/README.rst b/auth_oidc/README.rst index 47ea133ab5..e39b796376 100644 --- a/auth_oidc/README.rst +++ b/auth_oidc/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ============================= Authentication OpenID Connect ============================= @@ -17,7 +13,7 @@ Authentication OpenID Connect .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github @@ -38,6 +34,9 @@ using the authorization code flow or implicit flow. Note the implicit flow is not recommended because it exposes access tokens to the browser and in http logs. +Note disabling certificate checks is a security risk and not +recommended. Use it with caution. + **Table of contents** .. contents:: diff --git a/auth_oidc/models/auth_oauth_provider.py b/auth_oidc/models/auth_oauth_provider.py index d5d1a82772..8dfdac2279 100644 --- a/auth_oidc/models/auth_oauth_provider.py +++ b/auth_oidc/models/auth_oauth_provider.py @@ -47,10 +47,22 @@ class AuthOauthProvider(models.Model): ) jwks_uri = fields.Char(string="JWKS URL", help="Required for OpenID Connect.") end_session_endpoint = fields.Char(string="End Session URL") + ca_bundle = fields.Char( + string="CA bundle", help="Path to CA bundles to use for verification." + ) + disable_certificate_check = fields.Boolean( + string="Disable certificate check", + help="Disable certificate check. This is a security risk. Use with caution.", + ) @tools.ormcache("self.jwks_uri", "kid") def _get_keys(self, kid): - r = requests.get(self.jwks_uri, timeout=10) + verify = True + if self.disable_certificate_check: + verify = False + elif self.ca_bundle: + verify = self.ca_bundle + r = requests.get(self.jwks_uri, timeout=10, verify=verify) r.raise_for_status() response = r.json() # the keys returned here should follow diff --git a/auth_oidc/models/res_users.py b/auth_oidc/models/res_users.py index 1684480fa4..72d89f2adb 100644 --- a/auth_oidc/models/res_users.py +++ b/auth_oidc/models/res_users.py @@ -27,6 +27,11 @@ def _auth_oauth_get_tokens_auth_code_flow(self, oauth_provider, params): auth = None if oauth_provider.client_secret: auth = (oauth_provider.client_id, oauth_provider.client_secret) + verify = True + if oauth_provider.disable_certificate_check: + verify = False + elif oauth_provider.ca_bundle: + verify = oauth_provider.ca_bundle response = requests.post( oauth_provider.token_endpoint, data=dict( @@ -38,6 +43,7 @@ def _auth_oauth_get_tokens_auth_code_flow(self, oauth_provider, params): ), auth=auth, timeout=10, + verify=verify, ) response.raise_for_status() response_json = response.json() diff --git a/auth_oidc/readme/DESCRIPTION.md b/auth_oidc/readme/DESCRIPTION.md index 3677c8bbaa..6442283983 100644 --- a/auth_oidc/readme/DESCRIPTION.md +++ b/auth_oidc/readme/DESCRIPTION.md @@ -3,3 +3,6 @@ using the authorization code flow or implicit flow. Note the implicit flow is not recommended because it exposes access tokens to the browser and in http logs. + +Note disabling certificate checks is a security risk and not recommended. +Use it with caution. diff --git a/auth_oidc/static/description/index.html b/auth_oidc/static/description/index.html index 319e44bead..d845ef50b2 100644 --- a/auth_oidc/static/description/index.html +++ b/auth_oidc/static/description/index.html @@ -3,7 +3,7 @@
-This module allows users to login through an OpenID Connect provider using the authorization code flow or implicit flow.
Note the implicit flow is not recommended because it exposes access tokens to the browser and in http logs.
+Note disabling certificate checks is a security risk and not +recommended. Use it with caution.
Table of contents
This module depends on the python-jose library, not to be confused with jose which is also available on PyPI.
Example configuration with OpenID Connect authorization code flow.
Example configuration with OpenID Connect authorization code flow.
In Keycloak:
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -574,9 +571,9 @@
Do not contact contributors directly about support or help with technical issues.