Skip to content

@nogoo9/no-crd / index / hasRequiredScope

Function: hasRequiredScope()

hasRequiredScope(jwtPayload, requiredScope?, jsonPathExpr?, strict?): boolean

Defined in: src/k8s/auth.ts:485

Checks if the JWT payload contains the required scope. Supports both space-separated scope strings and array of scopes.

Parameters

jwtPayload

unknown

Decrypted JWT payload dictionary.

requiredScope?

string

The required scope string (e.g., "mcp:read"). If undefined, returns true.

jsonPathExpr?

string = "$.scope"

JSONPath expression specifying where the scope claim resides. Defaults to "$.scope".

strict?

boolean = false

Returns

boolean

true if scope is present/valid, false otherwise.