Skip to content

@nogoo9/no-crd / index / extractAdminRole

Function: extractAdminRole() ​

extractAdminRole(jwtPayload, jsonPathExpr?, adminRole?): boolean

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

Extracts the user's roles from a decrypted JWT payload using JSONPath. Checks if the configured admin role is present in those roles.

Parameters ​

jwtPayload ​

unknown

Decrypted JWT payload dictionary.

jsonPathExpr? ​

string = "$.realm_access.roles"

JSONPath expression specifying where the roles array resides. Defaults to "$.realm_access.roles".

adminRole? ​

string = "nogoo9-admin"

Name of the admin role to check for. Defaults to "nogoo9-admin".

Returns ​

boolean

true if the user has the admin role, false otherwise.