Skip to content

Conversation

@boutell
Copy link
Member

@boutell boutell commented Jul 3, 2025

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 factory feature 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.

},
strategies: [
{
async factory(params, fn) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

strategies: [
{
async factory(params, fn) {
const issuer = new URL(process.env.OIDC_ISSUER);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of discovery, all we need is a URL to the provider site (OIDC_ISSUER), OIDC_CLIENT_ID, and OIDC_CLIENT_SECRET.

} = params;
const s = new Strategy({
config,
scope: 'openid email',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can beef this up if you have other scopes of interest.

options: {},
// Use the user's email address as their identity
match: 'email',
// Strategy-specific options that must be passed to the authenticate middleware.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you should be able to skip this "authenticate" property because it is covered by the factory function.

<h1>User Info</h1>
<ul>
{% for name, value in data.user %}
<li>{{ name }}: {{ value }}</li>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just showing we get access.

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.

2 participants