backend-plugin-api: switch principal mapping to use none instead of unauthenticated
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -115,7 +115,7 @@ export type BackstageNonePrincipal = {
|
||||
export type BackstagePrincipalTypes = {
|
||||
user: BackstageUserPrincipal;
|
||||
service: BackstageServicePrincipal;
|
||||
unauthenticated: BackstageNonePrincipal;
|
||||
none: BackstageNonePrincipal;
|
||||
unknown: unknown;
|
||||
};
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export type BackstageCredentials<TPrincipal = unknown> = {
|
||||
export type BackstagePrincipalTypes = {
|
||||
user: BackstageUserPrincipal;
|
||||
service: BackstageServicePrincipal;
|
||||
unauthenticated: BackstageNonePrincipal;
|
||||
none: BackstageNonePrincipal;
|
||||
unknown: unknown;
|
||||
};
|
||||
|
||||
|
||||
@@ -60,13 +60,13 @@ export class MockHttpAuthService implements HttpAuthService {
|
||||
return credentials as any;
|
||||
}
|
||||
|
||||
if (this.#auth.isPrincipal(credentials, 'unauthenticated')) {
|
||||
if (this.#auth.isPrincipal(credentials, 'none')) {
|
||||
if (allowedPrincipalTypes.includes('none' as TAllowed)) {
|
||||
return credentials as any;
|
||||
}
|
||||
|
||||
throw new NotAllowedError(
|
||||
`This endpoint does not allow 'unauthenticated' credentials`,
|
||||
`This endpoint does not allow 'none' credentials`,
|
||||
);
|
||||
} else if (this.#auth.isPrincipal(credentials, 'user')) {
|
||||
if (allowedPrincipalTypes.includes('user' as TAllowed)) {
|
||||
|
||||
Reference in New Issue
Block a user