|
1 | 1 | import { createBackend } from '@backstage/backend-defaults'; |
2 | | -import { createBackendModule } from '@backstage/backend-plugin-api'; |
3 | | -import { gitlabAuthenticator } from '@backstage/plugin-auth-backend-module-gitlab-provider'; |
4 | | -import { |
5 | | - authProvidersExtensionPoint, |
6 | | - createOAuthProviderFactory, |
7 | | -} from '@backstage/plugin-auth-node'; |
8 | 2 | import { |
9 | 3 | catalogPluginGitlabFillerProcessorModule, |
10 | 4 | gitlabPlugin, |
11 | 5 | } from '@immobiliarelabs/backstage-plugin-gitlab-backend'; |
12 | 6 |
|
13 | | -const customAuth = createBackendModule({ |
14 | | - // This ID must be exactly "auth" because that's the plugin it targets |
15 | | - pluginId: 'auth', |
16 | | - // This ID must be unique, but can be anything |
17 | | - moduleId: 'custom-auth-provider', |
18 | | - register(reg) { |
19 | | - reg.registerInit({ |
20 | | - deps: { providers: authProvidersExtensionPoint }, |
21 | | - async init({ providers }) { |
22 | | - providers.registerProvider({ |
23 | | - providerId: 'gitlab', |
24 | | - factory: createOAuthProviderFactory({ |
25 | | - authenticator: gitlabAuthenticator, |
26 | | - async signInResolver(info, ctx) { |
27 | | - console.log(info); |
28 | | - const userEntity = 'user:default/guest'; |
29 | | - return ctx.issueToken({ |
30 | | - claims: { |
31 | | - sub: userEntity, |
32 | | - ent: [userEntity], |
33 | | - }, |
34 | | - }); |
35 | | - }, |
36 | | - }), |
37 | | - }); |
38 | | - }, |
39 | | - }); |
40 | | - }, |
41 | | -}); |
42 | | - |
43 | 7 | const backend = createBackend(); |
44 | 8 |
|
45 | 9 | // Auth |
46 | 10 | backend.add(import('@backstage/plugin-auth-backend')); |
47 | | -// backend.add(import('@backstage/plugin-auth-backend-module-github-provider')); |
48 | | -// backend.add(import('@backstage/plugin-auth-backend-module-gitlab-provider')); |
49 | | -backend.add(customAuth); |
| 11 | +backend.add(import('@backstage/plugin-auth-backend-module-guest-provider')); |
| 12 | +backend.add(import('@backstage/plugin-auth-backend-module-gitlab-provider')); |
50 | 13 |
|
51 | 14 | // Catalog with Scaffolder module |
52 | 15 | backend.add(import('@backstage/plugin-catalog-backend')); |
|
0 commit comments