auth-backend: always use full user/group entity refs

Signed-off-by: Himanshu Mishra <himanshu@orkohunter.net>
This commit is contained in:
Himanshu Mishra
2021-05-20 15:47:01 +02:00
committed by Fredrik Adelöw
parent 7dd84f37f0
commit db1d558411
2 changed files with 2 additions and 5 deletions
+1 -4
View File
@@ -51,10 +51,7 @@ export default async function createPlugin({
// Let's use the username in the email ID as the user's default unique identifier inside Backstage
const id = email.split('@')[0];
// Let's add the unique ID in the list
ent.push(id)
// Note: While the complete entity references look like `kind:namespace/name`, it should be safe to assume
// that standalone strings without any : or / can be interpresed as user kind in the default namespace. So,
// a 'freben' inside the `ent` list should be translated to `User:default/freben` when making any assertions.
ent.push(`User:default/${id}`)
// Let's call the GitHub Enterprise API inside the company and get the teams that the user belongs to
const gheUsername = getGheUsername(email);
+1 -1
View File
@@ -42,7 +42,7 @@ export default async function createPlugin({
}
const id = email.split('@')[0];
const token = await ctx.tokenIssuer.issueToken({
claims: { sub: id, ent: [id] },
claims: { sub: id, ent: [`User:default/${id}`] },
});
return { id, token };
},