Connectum API Reference / @connectum/auth / AuthInterceptorOptions
Interface: AuthInterceptorOptions ​
Defined in: packages/auth/src/types.ts:129
Generic auth interceptor options
Properties ​
cache? ​
optionalcache?:CacheOptions
Defined in: packages/auth/src/types.ts:179
LRU cache for credentials verification results. Caches AuthContext by credential string to reduce verification overhead.
The cache stores a private copy of the identity, and every request served from it receives its own copy (including roles, scopes and claims, nested plain objects and arrays too), so a handler that changes its AuthContext does not change what a later request with the same credential receives. Each hit costs one pass over the identity, proportional to its size.
extractCredentials? ​
optionalextractCredentials?: (req) =>string|Promise<string|null> |null
Defined in: packages/auth/src/types.ts:137
Extract credentials from request. Default: extracts Bearer token from Authorization header.
Parameters ​
req ​
Request with headers
header ​
Headers
Returns ​
string | Promise<string | null> | null
Credential string or null if no credentials found
propagatedClaims? ​
optionalpropagatedClaims?:string[]
Defined in: packages/auth/src/types.ts:186
Filter which claims are propagated in headers (SEC-001). When set, only listed claim keys are included in x-auth-claims header. When not set, all claims are propagated.
propagateHeaders? ​
optionalpropagateHeaders?:boolean
Defined in: packages/auth/src/types.ts:168
Propagate auth context as headers for downstream services.
Default ​
falseskipMethods? ​
optionalskipMethods?:string[]
Defined in: packages/auth/src/types.ts:162
Methods to skip authentication for. Patterns: "Service/Method" or "Service/*"; any other pattern, a partial wildcard included, throws when the interceptor is created. The catch-all "*" is refused: creating the interceptor throws, because it would switch authentication off for every method (to disable the interceptor, do not register it).
Default ​
[] (health and reflection methods are NOT auto-skipped)verifyCredentials ​
verifyCredentials: (
credentials) =>AuthContext|Promise<AuthContext>
Defined in: packages/auth/src/types.ts:152
Verify credentials and return auth context. REQUIRED. Must throw on invalid credentials.
Error contract: a thrown ConnectError reaches the client unchanged (its code and message are sent verbatim, so keep the text public); any other thrown value becomes Unauthenticated: Authentication failed and its text is not sent. A returned value that is not an AuthContext (null, undefined, false, {}, a missing or mistyped subject, type, roles, scopes or claims) is treated the same way and is never cached.
Parameters ​
credentials ​
string
Extracted credential string
Returns ​
AuthContext | Promise<AuthContext>
AuthContext for valid credentials