To authenticate users with your custom authentication provider, create, install and configure your custom authentication backend and frontend plugins in {product}.
-
You added a custom {product-short} application configuration, and have sufficient permissions to modify it.
-
Exporting, packaging, and installing third-party plugins knowledge.
-
You collected the relevant information to connect to your custom authentication provider.
WarningThis procedure is using a custom LDAP authentication provider as an example. This example is not intended for production use.
-
Add the identified key/value pairs to your {product-short} secrets.
-
To allow {product-short} to use plugins for authentication rather than the builtin authentication providers, set the
ENABLE_AUTH_PROVIDER_MODULE_OVERRIDE
environment variable to true.ENABLE_AUTH_PROVIDER_MODULE_OVERRIDE
-
true
-
To add your custom authentication provider credentials to {product-short}, add the identified key/value pairs.
Example 1. Secrets for the LDAP example- LDAP_URL
-
Your LDAP server URL, such as
ldap://<my_host>:3893
. - LDAP_BIND_DN
-
Your LDAP bind distinguished name, such as
cn=serviceuser,ou=svcaccts,dc=glauth,dc=com
. - LDAP_BIND_PASSWORD
-
Your LDAP password, such as
mysecret
.
-
-
Create your custom authentication provider backend plugin, that:
-
Provides an authentication provider API.
-
Bridges authentication to your custom authentication provider.
-
Includes an example backend configuration in an `app-config.yaml`file.
Example 2. LDAP backend pluginsrc/index.ts
wrapper re-exporting the original pluginexport { default as default } from "@immobiliarelabs/backstage-plugin-ldap-auth-backend";
app-config.yaml
backend configurationauth: environment: production providers: ldap: production: ldapAuthenticationOptions: userSearchBase: ou=users,dc=glauth,dc=com usernameAttribute: uid adminDn: ${LDAP_BIND_DN} adminPassword: ${LDAP_BIND_PASSWORD} ldapOpts: url: - ${LDAP_URL}
-
-
Create your custom authentication provider frontend plugin, that:
-
Provides a custom
SignInPage
component. TheSignInPage
component is the place in a {product-short} app where the frontend API reference is connected to the appropriate backend authentication provider API service. -
Provides an API client for the backend authentication provider service.
-
Includes an example backend configuration in an `app-config.yaml`file.
Example 3. LDAP frontend pluginThe exported
SignInPage
component delegates to theLDAPSignInPage
component that is provided by thebackstage-plugin-ldap-auth
package.src/index.ts
wrapper re-exporting the original pluginexport * from '@immobiliarelabs/backstage-plugin-ldap-auth'; export { SignInPage } from './components/SignInPage/SignInPage';
src/components/SignInPage.ts
SignInPage
componentimport React from 'react'; import { SignInPageProps } from '@backstage/core-plugin-api'; import { LdapAuthFrontendPage } from '@immobiliarelabs/backstage-plugin-ldap-auth'; export function SignInPage(props: SignInPageProps): React.JSX.Element { return <LdapAuthFrontendPage {...props} provider="ldap" />; }
app-config.yaml
frontend configurationdynamicPlugins: frontend: immobiliarelabs-backstage-plugin-ldap-auth: components: - name: SignInPage module: PluginRoot importName: SignInPage
-
-
Add your custom plugins configuration to
dynamic-plugins.yaml
in {product-short}.Example 4.dynamic-plugins.yaml
excerpt for LDAP catalog supportplugins: - package: ./dynamic-plugins/dist/backstage-plugin-catalog-backend-module-ldap-dynamic disabled: false pluginConfig: catalog: providers: ldapOrg: default: target: ${LDAP_URL} bind: dn: ${LDAP_BIND_DN} secret: ${LDAP_BIND_PASSWORD} users: - dn: ou=users,dc=glauth,dc=com options: scope: sub filter: (accountStatus=active) attributes: ['*', '+'] paged: false map: rdn: uid name: uid description: description displayName: uid email: mail picture: <nothing, left out> memberOf: memberOf groups: - dn: ou=groups,dc=glauth,dc=com options: scope: sub filter: (gidNumber=*) attributes: ['*', '+'] paged: false map: rdn: uid name: uid uid: uid displayName: uid description: description type: groupType email: <nothing, left out> picture: <nothing, left out> memberOf: memberOf members: member schedule: frequency: PT10M timeout: PT10M # optional, this is just to suppress any examples import: {} rules: - allow: [Component, System, Group, Resource, Location, Template, API, User] locations: [] - package: ./local-plugins/immobiliarelabs-backstage-plugin-ldap-auth disabled: false pluginConfig: dynamicPlugins: frontend: immobiliarelabs-backstage-plugin-ldap-auth: components: - name: SignInPage module: PluginRoot importName: SignInPage
-
To set up your custom authentication provider, edit your custom {product-short} ConfigMap such as
app-config-rhdh
, and add the following lines to theapp-config-rhdh.yaml
content:app-config-rhdh.yaml
fragment with mandatory fields to enable authentication withauth: environment: production providers: <your_custom_provider_id>: production: <your_custom_provider_configuration> signInPage: <your_custom_provider_id>
Example 5.app-config.yaml
excerpt for the LDAP exampleauth: environment: production providers: ldap: production: ldapAuthenticationOptions: userSearchBase: ou=users,dc=glauth,dc=com usernameAttribute: uid adminDn: ${LDAP_BIND_DN} adminPassword: ${LDAP_BIND_PASSWORD} ldapOpts: url: - ${LDAP_URL} signInPage: ldap
environment: production
-
Mark the environment as
production
to hide the Guest login in the {product-short} home page. <your_custom_provider_id>
section-
Use the {product-short} application information that you have created in your custom authentication provider and configured in OpenShift as secrets.
sigInPage: <your_custom_provider_id>
-
To enable the custom authentication provider as default sign-in provider.
-
Go to the {product-short} login page.
-
Your {product-short} sign-in page displays Sign in using <your_custom_authentication_provider_name> and the Guest user sign-in is disabled.
-
Log in with your custom authentication provider.