feat(scaffolder-backend): start migrating to use new auth services

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2024-02-21 16:45:25 +01:00
committed by blam
parent 6e0a8e5227
commit 0139e4c36e
21 changed files with 267 additions and 382 deletions
+5
View File
@@ -5,6 +5,7 @@
```ts
/// <reference types="node" />
import { BackstageCredentials } from '@backstage/backend-plugin-api';
import { JsonObject } from '@backstage/types';
import { JsonValue } from '@backstage/types';
import { Logger } from 'winston';
@@ -47,6 +48,7 @@ export type ActionContext<
};
signal?: AbortSignal;
each?: JsonObject;
getInitiatorCredentials(): Promise<BackstageCredentials>;
};
// @public (undocumented)
@@ -356,6 +358,8 @@ export interface TaskContext {
| undefined
>;
// (undocumented)
getInitiatorCredentials(): Promise<BackstageCredentials>;
// (undocumented)
getWorkspaceName(): Promise<string>;
// (undocumented)
isDryRun?: boolean;
@@ -385,6 +389,7 @@ export type TaskEventType = 'completion' | 'log' | 'cancelled' | 'recovered';
// @public
export type TaskSecrets = Record<string, string> & {
backstageToken?: string;
initiatorCredentials?: string;
};
// @public
@@ -21,6 +21,7 @@ import { TaskSecrets } from '../tasks';
import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
import { UserEntity } from '@backstage/catalog-model';
import { Schema } from 'jsonschema';
import { BackstageCredentials } from '@backstage/backend-plugin-api';
/**
* ActionContext is passed into scaffolder actions.
@@ -80,6 +81,11 @@ export type ActionContext<
* Optional value of each invocation
*/
each?: JsonObject;
/**
* Get the credentials for the current request
*/
getInitiatorCredentials(): Promise<BackstageCredentials>;
};
/** @public */
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import { BackstageCredentials } from '@backstage/backend-plugin-api';
import { TaskSpec } from '@backstage/plugin-scaffolder-common';
import { JsonObject, JsonValue, Observable } from '@backstage/types';
@@ -23,7 +24,11 @@ import { JsonObject, JsonValue, Observable } from '@backstage/types';
* @public
*/
export type TaskSecrets = Record<string, string> & {
/**
* @deprecated use "initiatorCredentials" instead
*/
backstageToken?: string;
initiatorCredentials?: string;
};
/**
@@ -140,6 +145,8 @@ export interface TaskContext {
): Promise<void>;
getWorkspaceName(): Promise<string>;
getInitiatorCredentials(): Promise<BackstageCredentials>;
}
/**