From db62da78d90a9c5bb37aae53e30ea134f0c73407 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 22 Feb 2024 17:33:33 +0100 Subject: [PATCH] backend-next: use stringifyEntityRef in github provider module Signed-off-by: Patrik Oldsberg --- packages/backend-next/package.json | 1 + packages/backend-next/src/authModuleGithubProvider.ts | 10 +++++++++- yarn.lock | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/backend-next/package.json b/packages/backend-next/package.json index c1f09cd0cb..74016539b0 100644 --- a/packages/backend-next/package.json +++ b/packages/backend-next/package.json @@ -28,6 +28,7 @@ "@backstage/backend-defaults": "workspace:^", "@backstage/backend-plugin-api": "workspace:^", "@backstage/backend-tasks": "workspace:^", + "@backstage/catalog-model": "workspace:^", "@backstage/plugin-adr-backend": "workspace:^", "@backstage/plugin-app-backend": "workspace:^", "@backstage/plugin-auth-backend": "workspace:^", diff --git a/packages/backend-next/src/authModuleGithubProvider.ts b/packages/backend-next/src/authModuleGithubProvider.ts index 5b71f35567..9245600d2c 100644 --- a/packages/backend-next/src/authModuleGithubProvider.ts +++ b/packages/backend-next/src/authModuleGithubProvider.ts @@ -15,6 +15,10 @@ */ import { createBackendModule } from '@backstage/backend-plugin-api'; +import { + DEFAULT_NAMESPACE, + stringifyEntityRef, +} from '@backstage/catalog-model'; import { githubAuthenticator } from '@backstage/plugin-auth-backend-module-github-provider'; import { authProvidersExtensionPoint, @@ -40,7 +44,11 @@ export default createBackendModule({ ); } - const userEntityRef = `user:default/${userId}`; + const userEntityRef = stringifyEntityRef({ + kind: 'User', + name: userId, + namespace: DEFAULT_NAMESPACE, + }); return ctx.issueToken({ claims: { diff --git a/yarn.lock b/yarn.lock index 5948d58b31..faf73dd135 100644 --- a/yarn.lock +++ b/yarn.lock @@ -27355,6 +27355,7 @@ __metadata: "@backstage/backend-defaults": "workspace:^" "@backstage/backend-plugin-api": "workspace:^" "@backstage/backend-tasks": "workspace:^" + "@backstage/catalog-model": "workspace:^" "@backstage/cli": "workspace:^" "@backstage/plugin-adr-backend": "workspace:^" "@backstage/plugin-app-backend": "workspace:^"