scaffolder-backend: remove auth-backend dependency

This commit is contained in:
Patrik Oldsberg
2021-02-10 11:59:30 +01:00
parent 6a50c6747d
commit d7f0203094
2 changed files with 5 additions and 3 deletions
-1
View File
@@ -34,7 +34,6 @@
"@backstage/catalog-model": "^0.7.1",
"@backstage/config": "^0.1.2",
"@backstage/integration": "^0.3.2",
"@backstage/plugin-auth-backend": "^0.2.12",
"@gitbeaker/core": "^28.0.2",
"@gitbeaker/node": "^28.0.2",
"@octokit/rest": "^18.0.12",
@@ -15,7 +15,6 @@
*/
import { Config } from '@backstage/config';
import { IdentityClient } from '@backstage/plugin-auth-backend';
import Docker from 'dockerode';
import express from 'express';
import { resolve as resolvePath } from 'path';
@@ -136,7 +135,7 @@ export async function createRouter(
// Forward authorization from client
const template = await entityClient.findTemplate(templateName, {
token: IdentityClient.getBearerToken(req.headers.authorization),
token: getBearerToken(req.headers.authorization),
});
const validationResult: ValidatorResult = validate(
@@ -299,3 +298,7 @@ export async function createRouter(
return app;
}
function getBearerToken(header?: string): string | undefined {
return header?.match(/Bearer\s+(\S+)/i)?.[1];
}