You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(docs): document auth via dynamic plugins (#2446)
This change adds the configuration updates and examples related to
installing and configuring authentication providers from dynamic
plugins. This change also fixes a couple small markdown lint warnings.
Signed-off-by: Stan Lewis <[email protected]>
Co-authored-by: Tomas Kral <[email protected]>
Copy file name to clipboardexpand all lines: docs/auth.md
+13-4
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,8 @@ In an example using Keycloak for authentication with the OIDC provider, there ar
123
123
The default resolver provided by the `oidc` auth provider is the `emailLocalPartMatchingUserEntityName` resolver.
124
124
125
125
If you want to use a different resolver, add the resolver you want to use in the `auth.providers.oidc.[environment].signIn.resolvers` configuration as soon in the example above, and it will override the default resolver.
126
-
* For enhanced security, consider using the `oidcSubClaimMatchingKeycloakUserId` resolver which matches the user with the immutable `sub` parameter from OIDC to the Keycloak user ID.
126
+
127
+
- For enhanced security, consider using the `oidcSubClaimMatchingKeycloakUserId` resolver which matches the user with the immutable `sub` parameter from OIDC to the Keycloak user ID.
127
128
128
129
For more information on setting up the OIDC auth provider, consult the [Backstage documentation](https://backstage.io/docs/auth/oidc#the-configuration).
129
130
@@ -201,11 +202,11 @@ auth:
201
202
202
203
### includeTransitiveGroupOwnership configuration value
203
204
204
-
This option allows users to add transitive parent groups into the resolved user group membership during the authentication process. i.e., the parent group of the user's direct group will be included in the user ownership entities. By default, this option is set to false.
205
+
This option allows users to add transitive parent groups into the resolved user group membership during the authentication process. i.e., the parent group of the user's direct group will be included in the user ownership entities. By default, this option is set to false.
External authentication providers can be loaded using the dynamic plugins mechanism. Typically this will require a backend plugin to provide the authentication provider API implementation and callback handling, and a frontend plugin to connect this API to important parts of the UI in the form of a [custom SignInPage](dynamic-plugins/frontend-plugin-wiring.md#use-a-custom-signinpage-component) and [provider settings](dynamic-plugins/frontend-plugin-wiring.md#adding-custom-authentication-provider-settings) entries for the user settings page.
230
+
231
+
The existing Developer Hub authentication module will need to be disabled by setting an [environment variable](dynamic-plugins/override-core-services.md#overriding-the-provided-authentication-module), `ENABLE_AUTH_PROVIDER_MODULE_OVERRIDE` to `true` for the Developer Hub backend.
232
+
233
+
Some examples of composing dynamic plugins to provide an authentication solution are available in the [dynamic plugins examples](dynamic-plugins/examples.md).
Copy file name to clipboardexpand all lines: docs/dynamic-plugins/examples.md
+6-1
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,12 @@ There are several example dynamic plugin projects that have been created to demo
5
5
> [!WARNING]
6
6
> The following examples are maintained on a best-effort basis, some adjustments may be needed to get an example running, especially against a different target RHDH version.
7
7
8
-
## For RHDH 1.4 (pre-release)
8
+
## For RHDH 1.5 (pre-release)
9
+
10
+
-[Using an third-party Authentication Provider via dynamic plugins](https://github.com/gashcrumb/dynamic-plugins-custom-authentication-module)
11
+
-[Composing various authentication providers via dynamic plugins](https://github.com/gashcrumb/dynamic-plugins-multiple-auth-modules)
12
+
13
+
## For RHDH 1.4
9
14
10
15
-[Installing a custom middleware function using a dynamic plugin](https://github.com/gashcrumb/dynamic-plugins-root-http-middleware)
Copy file name to clipboardexpand all lines: docs/dynamic-plugins/frontend-plugin-wiring.md
+37-1
Original file line number
Diff line number
Diff line change
@@ -434,7 +434,6 @@ dynamicPlugins:
434
434
435
435
Users can configure multiple application providers by adding entries to the `mountPoints` field.
436
436
437
-
438
437
## Customizing and Adding Entity tabs
439
438
440
439
Out of the box the frontend system provides an opinionated set of tabs for catalog entity views. This set of tabs can be further customized and extended as needed via the `entityTabs` configuration:
@@ -551,6 +550,43 @@ dynamicPlugins:
551
550
552
551
which would override the default `ScmAuth` API factory that Developer Hub defaults to.
553
552
553
+
## Adding custom authentication provider settings
554
+
555
+
Out of the box the Backstage user settings page supports all of the documented authentication providers, such as "github" or "microsoft". However it is possible to install new authentication providers from a dynamic plugin that either adds additional configuration support for an existing provider or adds a new authentication provider altogether. In either case, these providers are normally listed in the user settings section of the app under the "Authentication Providers" tab. To add entries for an authentication provider from a dynamic plugin, use the `providerSettings` configuration:
556
+
557
+
```yaml
558
+
dynamicPlugins:
559
+
frontend:
560
+
<package_name>:
561
+
providerSettings:
562
+
- title: My Custom Auth Provider
563
+
description: Sign in using My Custom Auth Provider
564
+
provider: core.auth.my-custom-auth-provider
565
+
```
566
+
567
+
Each provider settings entry should define the following attributes:
568
+
569
+
- `title`: The title for the authentication provider shown above the user's profile image if available.
570
+
- `description`: a short description of the authentication provider.
571
+
- `provider`: The ID of the authentication provider as provided to the `createApiRef` API call. This value is used to look up the corresponding API factory for the authentication provider to connect the provider's Sign In/Sign Out button.
572
+
573
+
## Use a custom SignInPage component
574
+
575
+
In a Backstage app the SignInPage component is used to connect one or more authentication providers to the application sign-in process. Out of the box in Developer Hub a static SignInPage is already set up and supports all of the built-in authentication providers already. To use a different authentication provider, for example from a dynamic plugin use the `signInPage` configuration:
576
+
577
+
```yaml
578
+
dynamicPlugins:
579
+
frontend:
580
+
<package_name>:
581
+
signInPage:
582
+
importName: CustomSignInPage
583
+
```
584
+
585
+
Only one `signInPage` is specified and used by the application, this configuration object supports the following properties:
586
+
587
+
- `module`: optional setting to specify which set of assets should be accessed from the dynamic plugin, defaults to `PluginRoot`
588
+
- `importName`: Required setting that should resolve to a component that returns a configured `SignInPage` component that connects the appropriate authentication provider factories, or a compatible custom implementation.
589
+
554
590
## Provide custom Scaffolder field extensions
555
591
556
592
The Backstage scaffolder component supports specifying [custom form fields](https://backstage.io/docs/features/software-templates/writing-custom-field-extensions/#creating-a-field-extension) for the software template wizard, for example:
Copy file name to clipboardexpand all lines: docs/dynamic-plugins/override-core-services.md
+6
Original file line number
Diff line number
Diff line change
@@ -56,3 +56,9 @@ To allow a dynamic plugin to load a core service override, start the Developer H
56
56
-`ENABLE_CORE_USERINFO_OVERRIDE` - allow overriding the `core.userInfo` service
57
57
-`ENABLE_CORE_URLREADER_OVERRIDE` - allow overriding the `core.urlReader` service
58
58
-`ENABLE_EVENTS_SERVICE_OVERRIDE` - allow overriding the `events.service` service
59
+
60
+
## Overriding the provided authentication module
61
+
62
+
Developer Hub ships with an opinionated authentication module setup that supports many use-cases. However it is also possible to disable this authentication module entirely and compose an authentication solution from a set of dynamic frontend and backend plugins. This requires disabling the provided authentication module so it doesn't conflict with any custom authentication configuration.
63
+
64
+
-`ENABLE_AUTH_PROVIDER_MODULE_OVERRIDE` - set to "true" to disable the Developer Hub provided backend authentication module
0 commit comments