diff --git a/.changeset/nasty-paws-move.md b/.changeset/nasty-paws-move.md new file mode 100644 index 0000000000..19d73ddc4d --- /dev/null +++ b/.changeset/nasty-paws-move.md @@ -0,0 +1,5 @@ +--- +'@backstage/create-app': patch +--- + +Tweaked template to provide an example and guidance for how to configure sign-in in `packages/backend/src/plugins/auth.ts`. There is no need to add this to existing apps, but for more information about sign-in configuration, see https://backstage.io/docs/auth/identity-resolver. diff --git a/packages/create-app/templates/default-app/packages/backend/src/plugins/auth.ts b/packages/create-app/templates/default-app/packages/backend/src/plugins/auth.ts index 1476e66150..13f18c55e9 100644 --- a/packages/create-app/templates/default-app/packages/backend/src/plugins/auth.ts +++ b/packages/create-app/templates/default-app/packages/backend/src/plugins/auth.ts @@ -1,4 +1,8 @@ -import { createRouter } from '@backstage/plugin-auth-backend'; +import { + createRouter, + providers, + defaultAuthProviderFactories, +} from '@backstage/plugin-auth-backend'; import { Router } from 'express'; import { PluginEnvironment } from '../types'; @@ -11,5 +15,22 @@ export default async function createPlugin( database: env.database, discovery: env.discovery, tokenManager: env.tokenManager, + providerFactories: { + ...defaultAuthProviderFactories, + + // This overrides the default GitHub auth provider with a custom one. + // Since the options are empty it will behave just like the default + // provider, but if you uncomment the `signIn` section you will enable + // sign-in via GitHub. This particular configuration uses a resolver + // that matches the username to the user entity name. See the auth + // documentation for more details on how to enable and customize sign-in: + // + // https://backstage.io/docs/auth/identity-resolver + github: providers.github.create({ + // signIn: { + // resolver: providers.github.resolvers.usernameMatchingUserEntityName(), + // }, + }), + }, }); }