backend-*-api: updates auth APIs for BEP changes

Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Co-authored-by: Camila Belo <camilaibs@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-02-15 14:45:08 +01:00
parent 05b7e91861
commit 413a9e7de8
11 changed files with 65 additions and 76 deletions
+10 -9
View File
@@ -22,16 +22,21 @@ export interface AuthService {
// (undocumented)
authenticate(token: string): Promise<BackstageCredentials>;
// (undocumented)
getOwnCredentials(): Promise<BackstageCredentials<BackstageServicePrincipal>>;
getOwnServiceCredentials(): Promise<
BackstageCredentials<BackstageServicePrincipal>
>;
// (undocumented)
getPluginRequestToken(options: {
onBehalfOf: BackstageCredentials;
targetPluginId: string;
}): Promise<{
token: string;
}>;
// (undocumented)
isPrincipal<TType extends keyof BackstagePrincipalTypes>(
credentials: BackstageCredentials,
type: TType,
): credentials is BackstageCredentials<BackstagePrincipalTypes[TType]>;
// (undocumented)
issueServiceToken(options: { forward: BackstageCredentials }): Promise<{
token: string;
}>;
}
// @public (undocumented)
@@ -295,10 +300,6 @@ export interface HttpAuthService {
): Promise<BackstageCredentials<BackstagePrincipalTypes[TAllowed]>>;
// (undocumented)
issueUserCookie(res: Response_2): Promise<void>;
// (undocumented)
requestHeaders(options: {
forward: BackstageCredentials;
}): Promise<Record<string, string>>;
}
// @public (undocumented)
@@ -70,10 +70,12 @@ export interface AuthService {
type: TType,
): credentials is BackstageCredentials<BackstagePrincipalTypes[TType]>;
getOwnCredentials(): Promise<BackstageCredentials<BackstageServicePrincipal>>;
getOwnServiceCredentials(): Promise<
BackstageCredentials<BackstageServicePrincipal>
>;
// TODO: should the caller provide the target plugin ID?
issueServiceToken(options: {
forward: BackstageCredentials;
getPluginRequestToken(options: {
onBehalfOf: BackstageCredentials;
targetPluginId: string;
}): Promise<{ token: string }>;
}
@@ -27,9 +27,5 @@ export interface HttpAuthService {
},
): Promise<BackstageCredentials<BackstagePrincipalTypes[TAllowed]>>;
requestHeaders(options: {
forward: BackstageCredentials;
}): Promise<Record<string, string>>;
issueUserCookie(res: Response): Promise<void>;
}