Auth Hook
Determine the validity of the session in onBeforeHandle, and return sessionStatus and sessionClaims from the resolve hook.
const rp = await OidcClient.factory({ authHookSettings: { loginRedirectUrl: "/path/to/login", disableRedirect: false, // ... }, //...});const authHook = rp.authHook;- If the session is valid:
sessionStatus: Session statussessionClaims: ID Token Claims- Ref:
IdTokenClaimstype definition ofopenid-client. - Ref: Claims and IDToken section in the
OpenID Connect Core 1.0.
- Ref:
- If the session is invalid:
- Redirect to
loginRedirectUrl. - If
disableRedirectistrue, bothsessionStatusandsessionClaimswill benull.
- Redirect to
- ElysiaJS plugin metadata
- name:
elysia-openid-client-auth-hook - seed:
settings.pluginSeedor elseissuerUrl
- name:
- Ref: OIDCClientAuthHookSettings