create-app: add sign-in resolver example
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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.
|
||||
@@ -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(),
|
||||
// },
|
||||
}),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user