Skip to main content

AuthService.isPrincipal()

Home > @backstage/backend-plugin-api > AuthService > isPrincipal

Checks if the given credentials are of the given type, and narrows the TypeScript type accordingly if there's a match.

Signature:

isPrincipal<TType extends keyof BackstagePrincipalTypes>(credentials: BackstageCredentials, type: TType): credentials is BackstageCredentials<BackstagePrincipalTypes[TType]>;

Parameters

Parameter

Type

Description

credentials

BackstageCredentials

type

TType

**Returns:**

credentials is BackstageCredentials<BackstagePrincipalTypes[TType]>