Skip to main content
Version: Next

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

ParameterTypeDescription
credentialsBackstageCredentials
typeTType

Returns:

credentials is BackstageCredentials<BackstagePrincipalTypes[TType]>