Skip to content

[18.0][MIG] auth_oauth_server: Migration to 18.0 - #1069

Open
LorenzoC0 wants to merge 3 commits into
OCA:18.0from
LorenzoC0:18.0-mig-auth_oauth_server
Open

LorenzoC0 wants to merge 3 commits into
OCA:18.0from
LorenzoC0:18.0-mig-auth_oauth_server

Conversation

@LorenzoC0

Copy link
Copy Markdown

Forward port of #1032

eLBati and others added 3 commits October 20, 2026 14:26
Odoo can log users in through external providers (auth_oauth, auth_oidc,
auth_saml) and accept bearer JWTs on routes (auth_jwt), but nothing lets
it issue tokens to third-party applications. This module makes Odoo an
OAuth 2.1 authorization server, following what the MCP authorization
specification requires, so that MCP clients can connect to an MCP server
hosted in Odoo by having the user log in and approve.

- Authorization code flow with mandatory PKCE (S256). Refresh tokens are
  stored as digests and rotated on each use; reusing a code or a rotated
  refresh token revokes the authorization.
- Discovery: authorization server metadata (RFC 8414) and protected
  resource metadata (RFC 9728).
- Clients registered by an administrator, through dynamic registration
  (RFC 7591), or identified by a Client ID Metadata Document, fetched
  from public addresses only.
- Tokens bound to the resource they were asked for (RFC 8707), iss in
  authorization responses (RFC 9207), token revocation (RFC 7009).
- Access tokens are short-lived JWTs signed with an auth_jwt validator
  created for each protected resource, so routes can use
  auth="jwt_<validator>". Each token is also checked against its
  authorization, so revoking one takes effect at once.
- Login is left to Odoo's login page (password, two-factor, auth_oauth,
  ...), followed by a consent page bound to the validated request.
- Users see and revoke the applications they connected in their
  preferences; administrators manage resources, clients and
  authorizations.

Assisted-by: Claude Opus 5.5
- post_init_hook takes the environment;
- settings in a block of their own, with the 17.0 setting layout;
- attrs turned into Python expressions, tree into list; the fields only
  used in expressions are no longer declared invisible; the actions
  have a path;
- the token, revocation and registration endpoints declare a read/write
  cursor: auth="none" routes are read-only by default since 17.2;
- the tests remove the auth="jwt_..." methods auth_jwt adds to ir.http
  for the validators of the resources, which Odoo now reports as leaked;
- f-strings and no bare expression, as ruff now requires.
@LorenzoC0 LorenzoC0 changed the title [18.0][MIG] auth_oauth_server: OAuth 2.1 authorization server [18.0][MIG] auth_oauth_server: Migration to 18.0 Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:auth_oauth_server Module auth_oauth_server series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants