OAuth2Config
Defined in: src/policies/auth/oauth2.ts:13
Configuration for the oauth2 policy.
Extends
Section titled “Extends”Properties
Section titled “Properties”cacheTtlSeconds?
Section titled “cacheTtlSeconds?”
optionalcacheTtlSeconds:number
Defined in: src/policies/auth/oauth2.ts:33
Cache introspection results for this many seconds. Default: 0 (no cache).
clientId?
Section titled “clientId?”
optionalclientId:string
Defined in: src/policies/auth/oauth2.ts:17
Client ID for authenticating with the introspection endpoint.
clientSecret?
Section titled “clientSecret?”
optionalclientSecret:string
Defined in: src/policies/auth/oauth2.ts:19
Client secret for authenticating with the introspection endpoint.
forwardTokenInfo?
Section titled “forwardTokenInfo?”
optionalforwardTokenInfo:Record<string,string>
Defined in: src/policies/auth/oauth2.ts:31
Map introspection response fields to request headers. Only applies with introspection.
headerName?
Section titled “headerName?”
optionalheaderName:string
Defined in: src/policies/auth/oauth2.ts:25
Header name when tokenLocation is “header”. Default: “authorization”.
headerPrefix?
Section titled “headerPrefix?”
optionalheaderPrefix:string
Defined in: src/policies/auth/oauth2.ts:27
Prefix to strip from header value. Default: “Bearer”.
introspectionTimeoutMs?
Section titled “introspectionTimeoutMs?”
optionalintrospectionTimeoutMs:number
Defined in: src/policies/auth/oauth2.ts:37
Introspection endpoint fetch timeout in milliseconds. Default: 5000.
introspectionUrl?
Section titled “introspectionUrl?”
optionalintrospectionUrl:string
Defined in: src/policies/auth/oauth2.ts:15
OAuth2 token introspection endpoint (RFC 7662).
localValidate()?
Section titled “localValidate()?”
optionallocalValidate: (token) =>boolean|Promise<boolean>
Defined in: src/policies/auth/oauth2.ts:21
Local validation function as alternative to introspection. Takes precedence if both provided.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean | Promise<boolean>
queryParam?
Section titled “queryParam?”
optionalqueryParam:string
Defined in: src/policies/auth/oauth2.ts:29
Query param name when tokenLocation is “query”. Default: “access_token”.
requiredScopes?
Section titled “requiredScopes?”
optionalrequiredScopes:string[]
Defined in: src/policies/auth/oauth2.ts:35
Required scopes — token must have ALL of these (space-separated scope string).
skip()?
Section titled “skip()?”
optionalskip: (c) =>boolean|Promise<boolean>
Defined in: src/policies/types.ts:33
Skip this policy when condition returns true
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean | Promise<boolean>
Inherited from
Section titled “Inherited from”tokenLocation?
Section titled “tokenLocation?”
optionaltokenLocation:"query"|"header"
Defined in: src/policies/auth/oauth2.ts:23
Where to look for the token. Default: “header”.