backend-defaults: rename viaSubject to issuedBy
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
@@ -87,6 +87,7 @@ export class DefaultAuthService implements AuthService {
|
||||
userResult.userEntityRef,
|
||||
token,
|
||||
this.#getJwtExpiration(token),
|
||||
this.pluginId,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ export function createCredentialsWithUserPrincipal(
|
||||
sub: string,
|
||||
token: string,
|
||||
expiresAt?: Date,
|
||||
viaSubject?: string,
|
||||
issuedBySubject?: string,
|
||||
): InternalBackstageCredentials<BackstageUserPrincipal> {
|
||||
return Object.defineProperty(
|
||||
{
|
||||
@@ -61,7 +61,9 @@ export function createCredentialsWithUserPrincipal(
|
||||
principal: {
|
||||
type: 'user',
|
||||
userEntityRef: sub,
|
||||
...(viaSubject && { via: { type: 'service', subject: viaSubject } }),
|
||||
...(issuedBySubject && {
|
||||
issuedBy: { type: 'service', subject: issuedBySubject },
|
||||
}),
|
||||
},
|
||||
},
|
||||
'token',
|
||||
|
||||
@@ -36,7 +36,16 @@ export type BackstageUserPrincipal = {
|
||||
*/
|
||||
userEntityRef: string;
|
||||
|
||||
via?: BackstageServicePrincipal;
|
||||
/**
|
||||
* The service principal that issued the token on behalf of the user.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* This field is present in scenarios where a backend service acts on behalf
|
||||
* of a user. It provides context about the intermediary service that
|
||||
* facilitated the authentication.
|
||||
*/
|
||||
issuedBy?: BackstageServicePrincipal;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user