From 3faed18fd31d512218d09866e74c154631209116 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 17 Jun 2022 18:02:48 +0200 Subject: [PATCH] docs: update auth providers usage Signed-off-by: Patrik Oldsberg --- contrib/docs/tutorials/aws-alb-aad-oidc-auth.md | 7 ++----- docs/auth/bitbucket/provider.md | 12 +++++------- docs/auth/identity-resolver.md | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/contrib/docs/tutorials/aws-alb-aad-oidc-auth.md b/contrib/docs/tutorials/aws-alb-aad-oidc-auth.md index 2b3e02c18b..3cedf5634b 100644 --- a/contrib/docs/tutorials/aws-alb-aad-oidc-auth.md +++ b/contrib/docs/tutorials/aws-alb-aad-oidc-auth.md @@ -122,10 +122,7 @@ When using ALB auth you can configure it as described [here](https://backstage.i - replace the content of `packages/backend/plugin/auth.ts` with the below and tweak it according to your needs. ```ts -import { - createRouter, - createAwsAlbProvider, -} from '@backstage/plugin-auth-backend'; +import { createRouter, providers } from '@backstage/plugin-auth-backend'; import { DEFAULT_NAMESPACE, stringifyEntityRef, @@ -145,7 +142,7 @@ export default async function createPlugin({ database, discovery, providerFactories: { - awsalb: createAwsAlbProvider({ + awsalb: providers.awsAlb.create({ authHandler: async ({ fullProfile }) => { let email: string | undefined = undefined; if (fullProfile.emails && fullProfile.emails.length > 0) { diff --git a/docs/auth/bitbucket/provider.md b/docs/auth/bitbucket/provider.md index c54fb75ffa..36859dab45 100644 --- a/docs/auth/bitbucket/provider.md +++ b/docs/auth/bitbucket/provider.md @@ -57,7 +57,7 @@ In order to use the Bitbucket provider for sign-in, you must configure it with a `signIn.resolver`. See the [Sign-In Resolver documentation](../identity-resolver.md) for more details on how this is done. Note that for the Bitbucket provider, you'll want to use -`bitbucket` as the provider ID, and `createBitbucketProvider` for the provider +`bitbucket` as the provider ID, and `providers.bitbucket.create` for the provider factory. The `@backstage/plugin-auth-backend` plugin also comes with two built-in @@ -74,16 +74,14 @@ same way, but uses the Bitbucket user ID instead, and matches on the The following is an example of how to use one of the built-in resolvers: ```ts -import { - createBitbucketProvider, - bitbucketUsernameSignInResolver, -} from '@backstage/plugin-auth-backend'; +import { providers } from '@backstage/plugin-auth-backend'; // ... providerFactories: { - bitbucket: createBitbucketProvider({ + bitbucket: providers.bitbucket.create({ signIn: { - resolver: bitbucketUsernameSignInResolver, + resolver: + providers.bitbucket.resolvers.usernameMatchingUserEntityAnnotation(), }, }), }, diff --git a/docs/auth/identity-resolver.md b/docs/auth/identity-resolver.md index b314954105..c6d4ae2a89 100644 --- a/docs/auth/identity-resolver.md +++ b/docs/auth/identity-resolver.md @@ -304,7 +304,7 @@ export default async function createPlugin( return await createRouter({ ... providerFactories: { - google: createGoogleProvider({ + google: providers.google.create({ authHandler: async ({ fullProfile // Type: passport.Profile, idToken // Type: (Optional) string,