backend-defaults: add via to credentials
Co-authored-by: Fredrik Adelöw <freben@gmail.com> Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com> Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
@@ -68,6 +68,7 @@ export class DefaultAuthService implements AuthService {
|
||||
userResult.userEntityRef,
|
||||
pluginResult.limitedUserToken,
|
||||
this.#getJwtExpiration(pluginResult.limitedUserToken),
|
||||
pluginResult.subject,
|
||||
);
|
||||
}
|
||||
return createCredentialsWithServicePrincipal(pluginResult.subject);
|
||||
|
||||
@@ -51,6 +51,7 @@ export function createCredentialsWithUserPrincipal(
|
||||
sub: string,
|
||||
token: string,
|
||||
expiresAt?: Date,
|
||||
viaSubject?: string,
|
||||
): InternalBackstageCredentials<BackstageUserPrincipal> {
|
||||
return Object.defineProperty(
|
||||
{
|
||||
@@ -60,6 +61,7 @@ export function createCredentialsWithUserPrincipal(
|
||||
principal: {
|
||||
type: 'user',
|
||||
userEntityRef: sub,
|
||||
...(viaSubject && { via: { type: 'service', subject: viaSubject } }),
|
||||
},
|
||||
},
|
||||
'token',
|
||||
|
||||
@@ -35,6 +35,8 @@ export type BackstageUserPrincipal = {
|
||||
* The entity ref of the user entity that this principal represents.
|
||||
*/
|
||||
userEntityRef: string;
|
||||
|
||||
via?: BackstageServicePrincipal;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user