This repository was archived by the owner on Jul 2, 2026. It is now read-only.
OIDC example using openid-client and @apostrophecms/passport-bridge version 1.5.0-beta.1#130
Draft
boutell wants to merge 3 commits into
Draft
OIDC example using openid-client and @apostrophecms/passport-bridge version 1.5.0-beta.1#130boutell wants to merge 3 commits into
boutell wants to merge 3 commits into
Conversation
boutell
commented
Jul 3, 2025
| }, | ||
| strategies: [ | ||
| { | ||
| async factory(params, fn) { |
Member
Author
There was a problem hiding this comment.
New factory option allows us to pass our own async function that returns a fully initialized strategy object. This allows us to use OIDC discovery
boutell
commented
Jul 3, 2025
| strategies: [ | ||
| { | ||
| async factory(params, fn) { | ||
| const issuer = new URL(process.env.OIDC_ISSUER); |
Member
Author
There was a problem hiding this comment.
Because of discovery, all we need is a URL to the provider site (OIDC_ISSUER), OIDC_CLIENT_ID, and OIDC_CLIENT_SECRET.
boutell
commented
Jul 3, 2025
| } = params; | ||
| const s = new Strategy({ | ||
| config, | ||
| scope: 'openid email', |
Member
Author
There was a problem hiding this comment.
You can beef this up if you have other scopes of interest.
boutell
commented
Jul 3, 2025
| options: {}, | ||
| // Use the user's email address as their identity | ||
| match: 'email', | ||
| // Strategy-specific options that must be passed to the authenticate middleware. |
Member
Author
There was a problem hiding this comment.
Actually you should be able to skip this "authenticate" property because it is covered by the factory function.
boutell
commented
Jul 3, 2025
| <h1>User Info</h1> | ||
| <ul> | ||
| {% for name, value in data.user %} | ||
| <li>{{ name }}: {{ value }}</li> |
Member
Author
There was a problem hiding this comment.
Just showing we get access.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Luiz,
Here is a draft PR to show you the changes I made to our assembly essentials starter kit in order to permit login via OIDC in the dashboard.
For test purposes, I used keycloak as an OIDC identity provider.
To obtain HTTPS URLs for local testing, I ran both apostrophe and keycloak behind ngrok. Strict OIDC forbids HTTP URLs.
Note the use of the new passport-bridge
factoryfeature which allows us to initialize the passport strategy in a completely custom way, adapt the function signature of the verify function, and adapt the profile property names in one place.Note also we are using a specific beta release of passport-bridge here.
Please let me know your findings. If this works for your needs I anticipate it will be released under a stable version number on Wednesday.