inject auth

Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
aramissennyeydd
2024-04-22 10:46:19 -04:00
parent db7c4847f2
commit f50d970af6
+6 -2
View File
@@ -233,13 +233,15 @@ The Backstage backend also offers a core service to access the user's identity.
deps: {
// highlight-start
httpAuth: coreServices.httpAuth,
userInfo: coreServices.userInfo
userInfo: coreServices.userInfo,
auth: coreServices.auth,
// highlight-end
},
async init({
// highlight-start
httpAuth,
userInfo,
auth,
// highlight-end
}) {
httpRouter.use(
@@ -247,6 +249,7 @@ async init({
// highlight-start
httpAuth,
userInfo,
auth,
// highlight-end
logger,
}),
@@ -262,6 +265,7 @@ export interface RouterOptions {
// highlight-start
userInfo: UserInfoService;
httpAuth: HttpAuthService;
auth: AuthService;
// highlight-end
}
@@ -269,7 +273,7 @@ export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {
// ...
const { userInfo, httpAuth } = options;
const { userInfo, httpAuth, auth } = options;
router.post('/me', async (request, response) => {
if (!auth.isPrincipal(credentials, 'user')) {