Connectum API Reference / @connectum/auth / SessionAuthInterceptorOptions
Interface: SessionAuthInterceptorOptions ​
Defined in: packages/auth/src/types.ts:625
Session-based auth interceptor options.
Two-step authentication: verify session token, then map session data to AuthContext.
Properties ​
cache? ​
readonlyoptionalcache?:CacheOptions
Defined in: packages/auth/src/types.ts:662
LRU cache for session verification results. Every request receives its own copy of the stored identity, as described for AuthInterceptorOptions.cache.
extractToken? ​
readonlyoptionalextractToken?: (req) =>string|Promise<string|null> |null
Defined in: packages/auth/src/types.ts:657
Custom token extraction. Default: extracts Bearer token from Authorization header. verifySession, mapSession and a set extractToken must be functions; creating the interceptor throws a TypeError naming the option otherwise.
Parameters ​
req ​
header ​
Headers
Returns ​
string | Promise<string | null> | null
mapSession ​
readonlymapSession: (session) =>AuthContext|Promise<AuthContext>
Defined in: packages/auth/src/types.ts:650
Map raw session data to AuthContext.
A result that is not an AuthContext (null, undefined, false, {}, a missing or mistyped subject, type, roles, scopes or claims) ends the call with Unauthenticated: Session mapping failed; it is never cached.
Parameters ​
session ​
unknown
Raw session data from verifySession
Returns ​
AuthContext | Promise<AuthContext>
Normalized auth context
propagatedClaims? ​
readonlyoptionalpropagatedClaims?:string[]
Defined in: packages/auth/src/types.ts:675
Filter which claims are propagated in headers. When set, only listed claim keys are included in x-auth-claims header. When not set, all claims are propagated.
propagateHeaders? ​
readonlyoptionalpropagateHeaders?:boolean
Defined in: packages/auth/src/types.ts:669
Propagate auth context as headers for downstream services. An identity containing NUL, CR or LF is rejected with Unauthenticated (and never cached) while this is on. Text above U+00FF is written as utf-8'' plus percent-encoded UTF-8 (with x-auth-encoding: percent-utf8) and read back by the receiver. An identity that does not fit its header (subject over 512 characters, type over 128, name over 256, serialized roles, scopes or claims over 8192) is rejected too, never cut or left out.
skipMethods? ​
readonlyoptionalskipMethods?:string[]
Defined in: packages/auth/src/types.ts:664
Methods to skip authentication for. The catch-all "*" is refused (creation throws).
verifySession ​
readonlyverifySession: (token,headers) =>unknown
Defined in: packages/auth/src/types.ts:639
Verify session token and return raw session data. Must throw on invalid/expired sessions.
Error contract: a thrown ConnectError reaches the client unchanged (code and message verbatim, so keep the text public); any other thrown value becomes Unauthenticated: Session verification failed. The same holds for mapSession (fixed text Session mapping failed).
Parameters ​
token ​
string
Session token string
headers ​
Headers
Request headers (for additional context)
Returns ​
unknown
Raw session data