Document usage of authProvidersExtensionPoint for ScmAuthApi

Added example code for leveraging authProvidersExtensionPoint in the new backend system in auth main docs about ScmAuthApi.

Signed-off-by: 1337 <19777147+the-serious-programmer@users.noreply.github.com>
This commit is contained in:
1337
2025-12-08 15:42:28 +01:00
committed by GitHub
parent 410cc71d70
commit a2aa6ea7c5
+36
View File
@@ -459,6 +459,42 @@ providerFactories: {
},
```
In the new backend system you can leverage the `authProvidersExtensionPoint` for this:
```ts
// your-auth-plugin-module.ts
export const gheAuth = createBackendModule({
// This ID must be exactly "auth" because that's the plugin it targets
pluginId: 'auth',
// This ID must be unique, but can be anything
moduleId: 'ghe-auth-provider',
register(reg) {
reg.registerInit({
deps: {
providers: authProvidersExtensionPoint,
logger: coreServices.logger,
},
async init({ providers, logger }) {
providers.registerProvider({
// This ID must match the actual provider config, e.g. addressing
// auth.providers.ghe means that this must be "ghe".
providerId: 'ghe',
factory: createOAuthProviderFactory({
authenticator: githubAuthenticator,
signInResolverFactories: {
...commonSignInResolvers,
},
}),
});
},
});
},
});
// backend index.ts
backend.add(gheAuth);
```
## Configuring token issuers
By default, the Backstage authentication backend generates and manages its own signing keys automatically for any issued