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 @@ -README.rst +Authentication OpenID Connect -
+
+

Authentication OpenID Connect

- - -Odoo Community Association - -
-

Authentication OpenID Connect

-

Beta License: AGPL-3 OCA/server-auth Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/server-auth Translate me on Weblate Try me on Runboat

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

    @@ -413,15 +410,15 @@

    Authentication OpenID Connect

-

Installation

+

Installation

This module depends on the python-jose library, not to be confused with jose which is also available on PyPI.

-

Configuration

+

Configuration

-

Setup for Microsoft Azure

+

Setup for Microsoft Azure

Example configuration with OpenID Connect authorization code flow.

  1. configure a new web application in Azure with OpenID and code flow @@ -457,7 +454,7 @@

    Setup for Microsoft Azure

    image2

-

Setup for Keycloak

+

Setup for Keycloak

Example configuration with OpenID Connect authorization code flow.

In Keycloak:

    @@ -490,11 +487,11 @@

    Setup for Keycloak

-

Usage

+

Usage

On the login page, click on the authentication provider you configured.

-

Known issues / Roadmap

+

Known issues / Roadmap

  • When going to the login screen, check for a existing token and do a direct login without the clicking on the SSO link
  • @@ -503,70 +500,70 @@

    Known issues / Roadmap

-

Changelog

+

Changelog

-

16.0.1.1.0 2024-02-28

+

16.0.1.1.0 2024-02-28

  • Forward port OpenID Connect fixes from 15.0 to 16.0
-

16.0.1.0.1 2023-10-09

+

16.0.1.0.1 2023-10-09

  • Add AzureAD code flow provider
-

13.0.1.0.0 2020-04-10

+

13.0.1.0.0 2020-04-10

  • Odoo 13 migration, add authorization code flow.
-

10.0.1.0.0 2018-10-05

+

10.0.1.0.0 2018-10-05

  • Initial implementation
-

Bug Tracker

+

Bug Tracker

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 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • ICTSTUDIO
  • André Schenkels
  • @@ -584,7 +581,7 @@

    Authors

-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -608,6 +605,5 @@

Maintainers

-
diff --git a/auth_oidc/views/auth_oauth_provider.xml b/auth_oidc/views/auth_oauth_provider.xml index c890fb55a8..37c8b46f47 100644 --- a/auth_oidc/views/auth_oauth_provider.xml +++ b/auth_oidc/views/auth_oauth_provider.xml @@ -20,6 +20,10 @@ + + + +