From f50d970af685f490c3367f74d817269159f29268 Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Mon, 22 Apr 2024 10:46:19 -0400 Subject: [PATCH] inject auth Signed-off-by: aramissennyeydd --- docs/plugins/backend-plugin.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/plugins/backend-plugin.md b/docs/plugins/backend-plugin.md index 384c6ca861..fa27dcf8bb 100644 --- a/docs/plugins/backend-plugin.md +++ b/docs/plugins/backend-plugin.md @@ -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 { // ... - const { userInfo, httpAuth } = options; + const { userInfo, httpAuth, auth } = options; router.post('/me', async (request, response) => { if (!auth.isPrincipal(credentials, 'user')) {