message: backend: mock custom google auth provider
diff: * limitations under the License.
  */
  -import { createRouter } from '@backstage/plugin-auth-backend';
  +import {
  + createGoogleProvider,
  + createRouter,
  + defaultAuthProviderFactories,
  +} from '@backstage/plugin-auth-backend';
  import { Router } from 'express';
  import { PluginEnvironment } from '../types';
  @@ -24,5 +28,28 @@ export default async function createPlugin({
  config,
  discovery,
  }: PluginEnvironment): Promise<Router> {
  - return await createRouter({ logger, config, database, discovery });
  + return await createRouter({
  + logger,
  + config,
  + database,
  + discovery,
  + providerFactories: {
  + ...defaultAuthProviderFactories,
  + google: createGoogleProvider({
  + signIn: {
  + // resolver: 'email',
  + resolver: async ({ profile: { email } }, ctx) => {
  + if (!email) {
  + throw new Error('No email associated with user account');
  + }
  + const id = email.split('@')[0];
  + const token = await ctx.tokenIssuer.issueToken({
  + claims: { sub: id, ent: [id] },
  + });
  + return { id, token };
  + },
  + },
  + }),
  + },
  + });
  }
  