From 22f1047165cdea1473febd1a23c854ddb8b8d2d1 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 10 Jun 2022 15:50:54 +0200 Subject: [PATCH] docs/oauth2-proxy: update provider installation example Signed-off-by: Patrik Oldsberg --- docs/auth/oauth2-proxy/provider.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/auth/oauth2-proxy/provider.md b/docs/auth/oauth2-proxy/provider.md index e16d807cb4..e57ea96b26 100644 --- a/docs/auth/oauth2-proxy/provider.md +++ b/docs/auth/oauth2-proxy/provider.md @@ -40,19 +40,22 @@ or grab ID or access tokens to look up additional information and/or validate th A simple sign-in resolver might for example look like this: ```ts -providers.oauth2Proxy.create({ - signIn: { - async resolver({ result }, ctx) { - const name = result.getHeader('x-forwarded-user'); - if (!name) { - throw new Error('Request did not contain a user') - } - return ctx.signInWithCatalogUser({ - entityRef: { name }, - }); +providerFactories: { + ...defaultAuthProviderFactories, + oauth2Proxy: providers.oauth2Proxy.create({ + signIn: { + async resolver({ result }, ctx) { + const name = result.getHeader('x-forwarded-user'); + if (!name) { + throw new Error('Request did not contain a user') + } + return ctx.signInWithCatalogUser({ + entityRef: { name }, + }); + }, }, - }, -}), + }), +}, ``` ## Adding the provider to the Backstage frontend