-
Notifications
You must be signed in to change notification settings - Fork 278
Description
Which middleware is the feature for?
@hono/oidc-auth
What is the feature you are proposing?
Hello!
I'm using Keycloak for authentication and user management: https://www.keycloak.org/
I tried using @hono/oidc-auth middleware in this context, which works nicely so far.
The oidc-auth middleware makes an authorization request inside oidcAuthMiddleware function, here's the spot: https://github.com/honojs/middleware/blob/main/packages/oidc-auth/src/index.ts#L461
What I would like to do, is to manually make a similar authorization request call, but with additional query parameters. This matches the Keycloak's "Application initiated action" as described here: https://github.com/keycloak/keycloak-community/blob/main/design/application-initiated-actions.md#flows
For instance, when passing e.g. kc_action=update_profile as one of the query parameters, the authorization endpoint in Keycloak shows a UI for updating the user's profile.
Basically, I'd like to have something like
app.get('/auth/update', (c) => redirectOidcAuth(c, { kc_action: 'update_profile' });where redirectOidcAuth is extracted from oidcAuthMiddleware into a separate exported function, which also accepts additional query parameters.
At the moment, if I want to achieve this while still using this middleware to handle the redirection callback, I need to copy-paste some code from oidcAuthMiddleware and generateAuthorizationRequestUrl.