Skip to content

feat: XOAUTH2 hooks for OIDC authentication - #65

Open
jcdelepine wants to merge 1 commit into
horde:FRAMEWORK_6_0from
jcdelepine:feat/OidcIntegration
Open

jcdelepine wants to merge 1 commit into
horde:FRAMEWORK_6_0from
jcdelepine:feat/OidcIntegration

Conversation

@jcdelepine

Copy link
Copy Markdown
Contributor

Adds OIDC/XOAUTH2 hook examples to hooks.php.dist:

  • imap_preauthenticate: injects a Horde_Imap_Client_Password_Xoauth2 object when the user has OAuth2 tokens stored, falling back to password auth otherwise.

  • dynamic_prefs: proactively refreshes OAuth2 tokens before they expire during a session, and updates the IMAP password stored in the Horde session so active connections use the new token.

Also relaxes the credential check in IMP_Auth to accept either a password or a xoauth2_token, allowing OIDC sessions to authenticate without a stored password.

All hook code is commented out in the .dist file and must be explicitly activated by the administrator.

Depends on:

  • horde/Core: OIDC integration (PR #160)

@TDannhauer
TDannhauer requested a review from ralflang July 3, 2026 05:23
Add IMP_Application::authValidate(), wired via the 'validate' auth
capability, so token revocation (e.g. backchannel logout) is detected
on the next request. Reads the currently-active IMP_Imap connection's
server_key rather than the preferred/default backend, so validation
targets the backend the user is actually connected to.

Extend IMP_Imap_Config to recognise the 'oauth' backend option in
backends.php. IMP_Auth::_canAutoLogin() now reads it directly to
build XOAUTH2 credentials at primo-connection, regardless of the
Horde auth driver — this supersedes the imap_preauthenticate hook
example (removed from hooks.php.dist), which only ever fired at
that same primo-connection point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant