use stringifyEntityRef to build the user reference

Signed-off-by: Marco Crivellaro <marco.crive@gmail.com>
This commit is contained in:
Marco Crivellaro
2022-03-21 14:17:37 +00:00
parent ddb94bd241
commit e1b0db1908
@@ -109,6 +109,10 @@ import {
createRouter,
createAwsAlbProvider,
} from '@backstage/plugin-auth-backend';
import {
DEFAULT_NAMESPACE,
stringifyEntityRef,
} from '@backstage/catalog-model';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
@@ -154,7 +158,7 @@ export default async function createPlugin({
const [id] = email?.split('@') ?? '';
// Fetch from an external system that returns entity claims like:
// ['user:default/breanna.davison', ...]
const userEntityRef = `user:default/${id}`;
const userEntityRef = stringifyEntityRef({ kind: 'User', namespace: DEFAULT_NAMESPACE, name: id });
// Resolve group membership from the Backstage catalog
const fullEnt =