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:
IdTokenClaims
type 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
disableRedirect
istrue
, bothsessionStatus
andsessionClaims
will benull
.
- Redirect to
- ElysiaJS plugin metadata
- name:
elysia-openid-client-auth-hook
- seed:
settings.pluginSeed
or elseissuerUrl
- name:
- Ref: OIDCClientAuthHookSettings