Authentication in Red Hat Developer Hub
Configuring authentication to external services in Red Hat Developer Hub
Abstract
Preface
Depending on your organization’s security policies, you might require to identify and authorize users before giving them access to resources, such as Red Hat Developer Hub.
In Developer Hub, authentication and authorization are two separate processes:
- Authentication defines the user identity, and passes on this information to Developer Hub. Read the following chapters to configure authentication in Developer Hub.
- Authorization defines what the authenticated identity can access or do in Developer Hub. See Authorization in Red Hat Developer Hub.
To explore Developer Hub features, you can enable the guest user to skip configuring authentication and authorization, log in as the guest user, and access all the features.
The authentication system in Developer Hub is handled by external authentication providers.
Developer Hub supports following authentication providers:
- Red Hat Single-Sign On (RHSSO)
- GitHub
- Microsoft Azure
To identify users in Developer Hub, configure:
- One (and only one) authentication provider for sign-in and identification.
- Optionally, additional authentication providers for identification, to add more information to the user identity, or enable access to additional external resources.
For each authentication provider, set up the shared secret that the authentication provider and Developer Hub require to communicate, first in the authentication provider, then in Developer Hub.
Developer Hub stores user identity information in the Developer Hub software catalog.
To explore the authentication system and use Developer Hub without authorization policies, you can bypass the Developer Hub software catalog and start using Developer Hub without provisioning the Developer Hub software catalog.
To get, store, and update additional user information, such as group or team ownership, with the intention to use this data to define authorization policies, provision users and groups in the Developer Hub software catalog.
Developer Hub uses a one-way synchronization system to provision users and groups from your authentication system to the Developer Hub software catalog. Therefore, deleting users and groups by using Developer Hub Web UI or REST API might have unintended consequences.
Chapter 1. Authenticating with the Guest user
To explore Developer Hub features, you can skip configuring authentication and authorization. You can configure Developer Hub to log in as a Guest user and access Developer Hub features.
1.1. Authenticating with the Guest user on an Operator-based installation
After an Operator-based installation, you can configure Developer Hub to log in as a Guest user and access Developer Hub features.
Prerequisites
- You installed Developer Hub by using the Operator.
- You added a custom Developer Hub application configuration, and have sufficient permissions to modify it.
Procedure
- To enable the guest user in your Developer Hub custom configuration, edit your Developer Hub application configuration with following content: - app-config.yamlfragment- auth: environment: development providers: guest: dangerouslyAllowOutsideDevelopment: true- auth: environment: development providers: guest: dangerouslyAllowOutsideDevelopment: true- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
Verification
- Go to the Developer Hub login page.
- To log in with the Guest user account, click Enter in the Guest tile.
- In the Developer Hub Settings page, your profile name is Guest.
- You can use Developer Hub features.
1.2. Authenticating with the Guest user on a Helm-based installation
On a Helm-based installation, you can configure Developer Hub to log in as a Guest user and access Developer Hub features.
Prerequisites
- You added a custom Developer Hub application configuration, and have sufficient permissions to modify it.
- You use the Red Hat Developer Hub Helm chart to run Developer Hub.
Procedure
- To enable the guest user in your Developer Hub custom configuration, configure your Red Hat Developer Hub Helm Chart with following content: - Red Hat Developer Hub Helm Chart configuration fragment - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
Verification
- Go to the Developer Hub login page.
- To log in with the Guest user account, click Enter in the Guest tile.
- In the Developer Hub Settings page, your profile name is Guest.
- You can use Developer Hub features.
Chapter 2. Authenticating with Red Hat Build of Keycloak (RHBK)
RHSSO 7.6 is deprecated as an authentication provider. You can continue using RHSSO until the end of its maintenance support. For more information, see RHSSO lifecycle dates. As an alternative, consider migrating to Red Hat Build of Keycloak (RHBK).
To authenticate users with Red Hat Build of Keycloak (RHBK):
2.1. Enabling authentication with Red Hat Build of Keycloak (RHBK)
To authenticate users with Red Hat Build of Keycloak (RHBK), enable the OpenID Connect (OIDC) authentication provider in Red Hat Developer Hub.
Prerequisites
- You added a custom Developer Hub application configuration, and have sufficient permissions to modify it.
- You have sufficient permissions in RHSSO to create and manage a realm.
Procedure
- To allow Developer Hub to authenticate with RHBK, complete the steps in RHBK, to create a realm and a user and secure the first application: - Use an existing realm, or create a realm, with a distinctive Name such as <my_realm>. Save the value for the next step: - RHBK realm base URL, such as: <your_rhbk_URL>/realms/<your_realm>.
 
- To register your Developer Hub in RHBK, in the created realm, secure the first application, with: - Client ID: A distinctive client ID, such as <RHDH>.
- 
										Valid redirect URIs: Set to the OIDC handler URL: https://<RHDH_URL>/api/auth/oidc/handler/frame.
- Navigate to the Credentials tab and copy the Client secret.
- Save the values for the next step: - Client ID
- Client Secret
 
 
- To prepare for the verification steps, in the same realm, get the credential information for an existing user or create a user. Save the user credential information for the verification steps.
 
- To add your RHSSO credentials to your Developer Hub, add the following key/value pairs to your Developer Hub secrets: - AUTH_OIDC_CLIENT_ID
- Enter the saved Client ID.
- AUTH_OIDC_CLIENT_SECRET
- Enter the saved Client Secret.
- AUTH_OIDC_METADATA_URL
- Enter the saved RHBK realm base URL.
 
- To set up the RHBK authentication provider in your Developer Hub custom configuration, edit your custom Developer Hub ConfigMap such as - app-config-rhdh, and add the following lines to the- app-config.yamlcontent:- Configure mandatory fields: - app-config.yamlfragment with mandatory fields to enable authentication with RHBK- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - environment: production
- 
											Mark the environment as productionto hide the Guest login in the Developer Hub home page.
- metadataUrl,- clientId,- clientSecret
- To configure the OIDC provider with your secrets.
- sigInPage: oidc
- To enable the OIDC provider as default sign-in provider.
- prompt: auto
- To allow the identity provider to automatically determine whether to prompt for credentials or bypass the login redirect if an active RHSSO session exists.
 
 
					If prompt: auto is not set, the identity provider defaults to prompt: none, which assumes that you are already logged in and rejects sign-in requests without an active session.
				
- callbackUrl
- RHBK callback URL. - app-config.yamlfragment with optional- callbackURLfield- auth: providers: oidc: production: callbackUrl: ${AUTH_OIDC_CALLBACK_URL}- auth: providers: oidc: production: callbackUrl: ${AUTH_OIDC_CALLBACK_URL}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- tokenEndpointAuthMethod
- Token endpoint authentication method. - app-config.yamlfragment with optional- tokenEndpointAuthMethodfield- auth: providers: oidc: production: tokenEndpointAuthMethod: ${AUTH_OIDC_TOKEN_ENDPOINT_METHOD}- auth: providers: oidc: production: tokenEndpointAuthMethod: ${AUTH_OIDC_TOKEN_ENDPOINT_METHOD}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- tokenSignedResponseAlg
- Token signed response algorithm. - app-config.yamlfragment with optional- tokenSignedResponseAlgfield- auth: providers: oidc: production: tokenSignedResponseAlg: ${AUTH_OIDC_SIGNED_RESPONSE_ALG}- auth: providers: oidc: production: tokenSignedResponseAlg: ${AUTH_OIDC_SIGNED_RESPONSE_ALG}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- scope
- RHBK scope. - app-config.yamlfragment with optional- scopefield- auth: providers: oidc: production: scope: ${AUTH_OIDC_SCOPE}- auth: providers: oidc: production: scope: ${AUTH_OIDC_SCOPE}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- signIn
- resolvers
- After successful authentication, the user signing in must be resolved to an existing user in the Developer Hub catalog. To best match users securely for your use case, consider configuring a specific resolver. Enter the resolver list to override the default resolver: - emailLocalPartMatchingUserEntityName.- The authentication provider tries each sign-in resolver in order until it succeeds, and fails if none succeed. Warning- In production mode, only configure one resolver to ensure users are securely matched. - resolver
- Enter the sign-in resolver name. Available values: - 
															emailLocalPartMatchingUserEntityName
- 
															emailMatchingUserEntityProfileEmail
- 
															preferredUsernameMatchingUserEntityName
 
- 
															
 
 
app-config.yaml fragment with optional resolvers list
- dangerouslyAllowSignInWithoutUserInCatalog: true
- Configure the sign-in resolver to bypass the user provisioning requirement in the Developer Hub software catalog. Warning- Use this option to explore Developer Hub features, but do not use it in production. - app-config-rhdh.yamlfragment with optional field to allow signing in users absent from the software catalog- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - sessionDuration
- Lifespan of the user session. Enter a duration in - mslibrary format (such as '24h', '2 days'), ISO duration, or "human duration" as used in code.- app-config-rhdh.yamlfragment with optional- sessionDurationfield- auth: providers: github: production: sessionDuration: { hours: 24 }- auth: providers: github: production: sessionDuration: { hours: 24 }- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- auth
- backstageTokenExpiration
- To modify the Developer Hub token expiration from its default value of one hour, note that this refers to the validity of short-term cryptographic tokens, not the session duration. The expiration value must be set between 10 minutes and 24 hours.
 - . - app-config.yamlfragment with optional- auth.backstageTokenExpirationfield- auth: backstageTokenExpiration: { minutes: <user_defined_value> }- auth: backstageTokenExpiration: { minutes: <user_defined_value> }- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow Security consideration- If multiple valid refresh tokens are issued due to frequent refresh token requests, older tokens will remain valid until they expire. To enhance security and prevent potential misuse of older tokens, enable a refresh token rotation strategy in your RHBK realm. - From the Configure section of the navigation menu, click Realm Settings.
- From the Realm Settings page, click the Tokens tab.
- From the Refresh tokens section of the Tokens tab, toggle the Revoke Refresh Token to the Enabled position.
 
 
Verification
- Go to the Developer Hub login page.
- Your Developer Hub sign-in page displays Sign in using OIDC and the Guest user sign-in is disabled.
- Log in with OIDC by using the saved Username and Password values.
2.2. Provisioning users from Red Hat Build of Keycloak (RHBK) to the software catalog
Prerequisites
Procedure
- Enable the - backstage-plugin-catalog-backend-module-keycloak-dynamicplugin.- dynamic-plugins.yamlfile fragment- plugins: - package: './dynamic-plugins/dist/backstage-plugin-catalog-backend-module-keycloak-dynamic' disabled: false- plugins: - package: './dynamic-plugins/dist/backstage-plugin-catalog-backend-module-keycloak-dynamic' disabled: false- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- To enable RHBK member discovery, edit - app-config.yaml, your custom Developer Hub configuration file:- app-config.yamlfragment with mandatory- keycloakOrgfields- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - baseUrl
- Your RHBK server URL, defined when enabling authentication with RHBK.
- clientId
- Your Developer Hub application client ID in RHBK, defined when enabling authentication with RHBK.
- clientSecret
- Your Developer Hub application client secret in RHBK, defined when enabling authentication with RHBK.
 - Optional: Consider adding the following optional fields: - realm
- Realm to synchronize. Default value: - master.- app-config.yamlfragment with optional- realmfield- catalog: providers: keycloakOrg: default: realm: master- catalog: providers: keycloakOrg: default: realm: master- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- loginRealm
- Realm used to authenticate. Default value: - master.- app-config.yamlfragment with optional- loginRealmfield- catalog: providers: keycloakOrg: default: loginRealm: master- catalog: providers: keycloakOrg: default: loginRealm: master- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- userQuerySize
- User number to query simultaneously. Default value: - 100.- app-config.yamlfragment with optional- userQuerySizefield- catalog: providers: keycloakOrg: default: userQuerySize: 100- catalog: providers: keycloakOrg: default: userQuerySize: 100- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- groupQuerySize
- Group number to query simultaneously. Default value: - 100.- app-config.yamlfragment with optional- groupQuerySizefield- catalog: providers: keycloakOrg: default: groupQuerySize: 100- catalog: providers: keycloakOrg: default: groupQuerySize: 100- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- schedule.frequency
- To specify custom schedule frequency. Supports cron, ISO duration, and "human duration" as used in code. - app-config.yamlfragment with optional- schedule.frequencyfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- schedule.timeout
- To specify custom timeout. Supports ISO duration and "human duration" as used in code. - app-config.yamlfragment with optional- schedule.timeoutfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- schedule.initialDelay
- To specify custom initial delay. Supports ISO duration and "human duration" as used in code. - app-config.yamlfragment with optional- schedule.initialDelayfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
Verification
- Check the console logs to verify that the synchronization is completed. - Successful synchronization example: - {"class":"KeycloakOrgEntityProvider","level":"info","message":"Read 3 Keycloak users and 2 Keycloak groups in 1.5 seconds. Committing...","plugin":"catalog","service":"backstage","taskId":"KeycloakOrgEntityProvider:default:refresh","taskInstanceId":"bf0467ff-8ac4-4702-911c-380270e44dea","timestamp":"2024-09-25 13:58:04"} {"class":"KeycloakOrgEntityProvider","level":"info","message":"Committed 3 Keycloak users and 2 Keycloak groups in 0.0 seconds.","plugin":"catalog","service":"backstage","taskId":"KeycloakOrgEntityProvider:default:refresh","taskInstanceId":"bf0467ff-8ac4-4702-911c-380270e44dea","timestamp":"2024-09-25 13:58:04"}- {"class":"KeycloakOrgEntityProvider","level":"info","message":"Read 3 Keycloak users and 2 Keycloak groups in 1.5 seconds. Committing...","plugin":"catalog","service":"backstage","taskId":"KeycloakOrgEntityProvider:default:refresh","taskInstanceId":"bf0467ff-8ac4-4702-911c-380270e44dea","timestamp":"2024-09-25 13:58:04"} {"class":"KeycloakOrgEntityProvider","level":"info","message":"Committed 3 Keycloak users and 2 Keycloak groups in 0.0 seconds.","plugin":"catalog","service":"backstage","taskId":"KeycloakOrgEntityProvider:default:refresh","taskInstanceId":"bf0467ff-8ac4-4702-911c-380270e44dea","timestamp":"2024-09-25 13:58:04"}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Log in with an RHBK account.
2.3. Creating a custom transformer to provision users from Red Hat Build of Keycloak (RHBK) to the software catalog
				To customize how RHBK users and groups are mapped to Red Hat Developer Hub entities, you can create a backend module that uses the keycloakTransformerExtensionPoint to provide custom user and group transformers for the Keycloak backend.
			
Prerequisites
Procedure
- 
						Create a new backend module with the yarn newcommand.
- Add your custom user and group transformers to the - keycloakTransformerExtensionPoint.- The following is an example of how the backend module can be defined: - plugins/<module-name>/src/module.ts- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow Important- The module’s - pluginIdmust be set to- catalogto match the- pluginIdof the- keycloak-backend; otherwise, the module fails to initialize.
- Install this new backend module into your Developer Hub backend. - backend.add(import(backstage-plugin-catalog-backend-module-keycloak-transformer)) - backend.add(import(backstage-plugin-catalog-backend-module-keycloak-transformer))- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
Verification
- Developer Hub imports the users and groups each time when started. Check the console logs to verify that the synchronization is completed. - Successful synchronization example: - {"class":"KeycloakOrgEntityProvider","level":"info","message":"Read 3 Keycloak users and 2 Keycloak groups in 1.5 seconds. Committing...","plugin":"catalog","service":"backstage","taskId":"KeycloakOrgEntityProvider:default:refresh","taskInstanceId":"bf0467ff-8ac4-4702-911c-380270e44dea","timestamp":"2024-09-25 13:58:04"} {"class":"KeycloakOrgEntityProvider","level":"info","message":"Committed 3 Keycloak users and 2 Keycloak groups in 0.0 seconds.","plugin":"catalog","service":"backstage","taskId":"KeycloakOrgEntityProvider:default:refresh","taskInstanceId":"bf0467ff-8ac4-4702-911c-380270e44dea","timestamp":"2024-09-25 13:58:04"}- {"class":"KeycloakOrgEntityProvider","level":"info","message":"Read 3 Keycloak users and 2 Keycloak groups in 1.5 seconds. Committing...","plugin":"catalog","service":"backstage","taskId":"KeycloakOrgEntityProvider:default:refresh","taskInstanceId":"bf0467ff-8ac4-4702-911c-380270e44dea","timestamp":"2024-09-25 13:58:04"} {"class":"KeycloakOrgEntityProvider","level":"info","message":"Committed 3 Keycloak users and 2 Keycloak groups in 0.0 seconds.","plugin":"catalog","service":"backstage","taskId":"KeycloakOrgEntityProvider:default:refresh","taskInstanceId":"bf0467ff-8ac4-4702-911c-380270e44dea","timestamp":"2024-09-25 13:58:04"}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- After the first import is complete, navigate to the Catalog page and select User to view the list of users.
- When you select a user, you see the information imported from RHBK.
- You can select a group, view the list, and access or review the information imported from RHBK.
- You can log in with an RHBK account.
Chapter 3. Authenticating with GitHub
To authenticate users with GitHub or GitHub Enterprise:
3.1. Enabling authentication with GitHub
To authenticate users with GitHub, enable the GitHub authentication provider in Red Hat Developer Hub.
Prerequisites
- You added a custom Developer Hub application configuration, and have sufficient permissions to modify it.
- You have sufficient permissions in GitHub to create and manage a GitHub App.
Procedure
- To allow Developer Hub to authenticate with GitHub, create a GitHub App. Opt for a GitHub App instead of an OAuth app to use fine-grained permissions, gain more control over which repositories the application can access, and use short-lived tokens. - Register a GitHub App with the following configuration: - GitHub App name: Enter a unique name identifying your GitHub App, such as <Red Hat Developer Hub>-<GUID>.
- 
										Homepage URL: Your Developer Hub URL: https://<my_developer_hub_url>.
- 
										Authorization callback URL: Your Developer Hub authentication backend URL: https://<my_developer_hub_url>/api/auth/github/handler/frame.
- 
										Webhook URL: Your Developer Hub URL: https://<my_developer_hub_url>.
- Webhook secret: Provide a strong secret.
- Repository permissions: - Enable - Read-onlyaccess to:- Administration
- Commit statuses
- Contents
- Dependabot alerts
- Deployments
- Pull Requests
- Webhooks Tip- If you plan to make changes using the GitHub API, ensure that - Read and writepermissions are enabled instead of- Read-only.
 
- Toggle other permissions as per your needs.
 
- Organization permissions: - 
												Enable Read-onlyaccess to Members.
 
- 
												Enable 
- 
										For Where can this GitHub App be installed?, select Only on this account.
 
- In the General → Clients secrets section, click Generate a new client secret.
- In the General → Private keys section, click Generate a private key.
- In the Install App tab, choose an account to install your GitHub App on.
- Save the following values for the next step: - App ID
- Client ID
- Client secret
- Private key
- Webhook secret
 
 
- To add your GitHub credentials to Developer Hub, add the following key/value pairs to your Developer Hub secrets: - AUTH_GITHUB_APP_ID
- Enter the saved App ID.
- AUTH_GITHUB_CLIENT_ID
- Enter the saved Client ID.
- GITHUB_HOST_DOMAIN
- 
									Enter your GitHub host domain: github.comunless you are using GitHub Enterprise.
- GITHUB_ORGANIZATION
- Enter your GitHub organization name, such as `<your_github_organization_name>'.
- GITHUB_ORG_URL
- 
									Enter $GITHUB_HOST_DOMAIN/$GITHUB_ORGANIZATION.
- GITHUB_CLIENT_SECRET
- Enter the saved Client Secret.
- GITHUB_PRIVATE_KEY_FILE
- Enter the saved Private key.
- GITHUB_WEBHOOK_URL
- 
									Enter your Developer Hub URL: https://<my_developer_hub_url>.
- GITHUB_WEBHOOK_SECRET
- Enter the saved Webhook secret.
 
- . To set up the GitHub authentication provider and enable integration with the GitHub API in your Developer Hub custom configuration, edit your custom Developer Hub config map such as - my-rhdh-app-config, and add the following lines to the- app-config.yamlfile content:- app-config.yamlfile fragment with mandatory fields to enable authentication with GitHub- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 1
- Mark the environment asproductionand disable the Guest login option in the Developer Hub login page.
- 2
- Apply the GitHub credentials configured in your Developer Hub secrets.
- 3
- To enable the GitHub provider as your Developer Hub sign-in provider.- Optional: Consider adding the following optional fields: - callbackUrl
- The callback URL that GitHub uses when initiating an OAuth flow, such as: <your_intermediate_service_url/handler>. Define it when Developer Hub is not the immediate receiver, such as in cases when you use one OAuth app for many Developer Hub instances. - app-config.yamlfile fragment with optional- enterpriseInstanceUrlfield- auth: providers: github: production: callbackUrl: <your_intermediate_service_url/handler>- auth: providers: github: production: callbackUrl: <your_intermediate_service_url/handler>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- enterpriseInstanceUrl
- Your GitHub Enterprise URL. Requires you defined the - GITHUB_HOST_DOMAINsecret in the previous step.- app-config.yamlfile fragment with optional- enterpriseInstanceUrlfield- auth: providers: github: production: enterpriseInstanceUrl: ${GITHUB_HOST_DOMAIN}- auth: providers: github: production: enterpriseInstanceUrl: ${GITHUB_HOST_DOMAIN}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- signIn
- resolvers
- 
																After successful authentication, the user signing in must be resolved to an existing user in the Developer Hub catalog. To best match users securely for your use case, consider configuring a specific resolver. Enter the resolver list to override the default resolver: usernameMatchingUserEntityName.
 - The authentication provider tries each sign-in resolver in order until it succeeds, and fails if none succeed. Warning- In production mode, only configure one resolver to ensure users are securely matched. - resolver
- Enter the sign-in resolver name. Available resolvers: - 
																		usernameMatchingUserEntityName
- 
																		preferredUsernameMatchingUserEntityName
- 
																		emailMatchingUserEntityProfileEmail
 
- 
																		
- dangerouslyAllowSignInWithoutUserInCatalog: true
- Configure the sign-in resolver to bypass the user provisioning requirement in the Developer Hub software catalog. Warning- Use - dangerouslyAllowSignInWithoutUserInCatalogto explore Developer Hub features, but do not use it in production.- app-config.yamlfile fragment with optional field to allow signing in users absent from the software catalog- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
 
 
 
To enable GitHub integration with a different authentication provider, complete the following configurations:
- 
						Add the GitHub provider to the existing authsection.
- 
						Keep the signInPagesection from your authentication provider configuration.
app-config.yaml file fragment with mandatory fields to enable GitHub integration and use a different authentication provider
Verification
- Go to the Developer Hub login page.
- Your Developer Hub sign-in page displays Sign in using GitHub and the Guest user sign-in is disabled.
- Log in with GitHub.
3.2. Provisioning users from GitHub to the software catalog
To authenticate users, Red Hat Developer Hub requires their presence in the software catalog. Consider configuring Developer Hub to provision users from GitHub to the software catalog on schedule, rather than provisioning the users manually.
Prerequisites
- You have enabled authentication with GitHub, including the following secrets: - 
								GITHUB_HOST_DOMAIN
- 
								GITHUB_ORGANIZATION
 
- 
								
Procedure
- Enable the - backstage-plugin-catalog-backend-module-github-dynamicplugin.- dynamic-plugins.yamlfile fragment- plugins: - package: './dynamic-plugins/dist/backstage-plugin-catalog-backend-module-github-dynamic' disabled: false- plugins: - package: './dynamic-plugins/dist/backstage-plugin-catalog-backend-module-github-dynamic' disabled: false- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- To enable GitHub member discovery, edit - app-config.yaml, your custom Developer Hub configuration file:- app-config.yamlfragment with mandatory- githubfields- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - organization,- githubUrl, and- orgs
- Use the Developer Hub application information that you have created in GitHub and configured in OpenShift as secrets.
- schedule.frequency
- To specify custom schedule frequency. Supports cron, ISO duration, and "human duration" as used in code.
- schedule.timeout
- To specify custom timeout. Supports ISO duration and "human duration" as used in code.
- schedule.initialDelay
- To specify custom initial delay. Supports ISO duration and "human duration" as used in code.
 
Verification
- Check the console logs to verify that the synchronization is completed. - Successful synchronization example: - {"class":"GithubMultiOrgEntityProvider","level":"info","message":"Reading GitHub users and teams for org: rhdh-dast","plugin":"catalog","service":"backstage","target":"https://github.com","taskId":"GithubMultiOrgEntityProvider:production:refresh","taskInstanceId":"801b3c6c-167f-473b-b43e-e0b4b780c384","timestamp":"2024-09-09 23:55:58"} {"class":"GithubMultiOrgEntityProvider","level":"info","message":"Read 7 GitHub users and 2 GitHub groups in 0.4 seconds. Committing...","plugin":"catalog","service":"backstage","target":"https://github.com","taskId":"GithubMultiOrgEntityProvider:production:refresh","taskInstanceId":"801b3c6c-167f-473b-b43e-e0b4b780c384","timestamp":"2024-09-09 23:55:59"}- {"class":"GithubMultiOrgEntityProvider","level":"info","message":"Reading GitHub users and teams for org: rhdh-dast","plugin":"catalog","service":"backstage","target":"https://github.com","taskId":"GithubMultiOrgEntityProvider:production:refresh","taskInstanceId":"801b3c6c-167f-473b-b43e-e0b4b780c384","timestamp":"2024-09-09 23:55:58"} {"class":"GithubMultiOrgEntityProvider","level":"info","message":"Read 7 GitHub users and 2 GitHub groups in 0.4 seconds. Committing...","plugin":"catalog","service":"backstage","target":"https://github.com","taskId":"GithubMultiOrgEntityProvider:production:refresh","taskInstanceId":"801b3c6c-167f-473b-b43e-e0b4b780c384","timestamp":"2024-09-09 23:55:59"}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Log in with a GitHub account.
Chapter 4. Authentication with Microsoft Azure
To authenticate users with Microsoft Azure:
4.1. Enabling authentication with Microsoft Azure
Red Hat Developer Hub includes a Microsoft Azure authentication provider that can authenticate users by using OAuth.
Prerequisites
- You have the permission to register an application in Microsoft Azure. - You added a custom Developer Hub application configuration, and have sufficient permissions to modify it.
 
Procedure
- To allow Developer Hub to authenticate with Microsoft Azure, create an OAuth application in Microsoft Azure. - In the Azure portal go to App registrations, create a New registration with the configuration: - Name
- The application name in Azure, such as <My Developer Hub>.
 
- On the Home > App registrations > <My Developer Hub> > Manage > Authentication page, Add a platform, with the following configuration: - Redirect URI
- 
											Enter the backend authentication URI set in Developer Hub: https://<my_developer_hub_url>/api/auth/microsoft/handler/frame
- Front-channel logout URL
- Leave blank.
- Implicit grant and hybrid flows
- Leave all checkboxes cleared.
 
- On the Home > App registrations > <My Developer Hub> > Manage > API permissions page, Add a Permission, then add the following Delegated permission for the Microsoft Graph API: - 
										email
- 
										offline_access
- 
										openid
- 
										profile
- 
										User.Read.All
- 
										GroupMember.Read.All
- 
										Optional custom scopes for the Microsoft Graph API that you define both in this section and in the app-config.yamlDeveloper Hub configuration file.
 
- 
										
 
Your company might require you to grant admin consent for these permissions. Even if your company does not require admin consent, you might do so as it means users do not need to individually consent the first time they access backstage. To grant administrator consent, a directory administrator must go to the admin consent page and click Grant admin consent for COMPANY NAME.
- On the Home > App registrations > <My Developer Hub> > Manage > Certificates & Secrets page, in the Client secrets tab, create a New client secret.
- Save for the next step: - Directory (tenant) ID
- Application (client) ID
- Application (client) secret - To add your Microsoft Azure credentials to Developer Hub, add the following key/value pairs to your Developer Hub secrets: - AUTH_AZURE_TENANT_ID
- Enter your saved Directory (tenant) ID.
- AUTH_AZURE_CLIENT_ID
- Enter your saved Application (client) ID.
- AUTH_AZURE_CLIENT_SECRET
- Enter your saved Application (client) secret.
 
- Set up the Microsoft Azure authentication provider in your - app-config.yamlfile:- app-config.yamlfile fragment- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
 
- Optional: Consider adding following optional fields: - domainHint
- Optional for single-tenant applications. You can reduce login friction for users with accounts in multiple tenants by automatically filtering out accounts from other tenants. If you want to use this parameter for a single-tenant application, uncomment and enter the tenant ID. If your application registration is multi-tenant, leave this parameter blank. For more information, see Home Realm Discovery. - app-config.yamlfile fragment with optional- domainHintfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- additionalScopes
- Optional for additional scopes. To add scopes for the application registration, uncomment and enter the list of scopes that you want to add. The default and mandatory value lists: - 'openid', 'offline_access', 'profile', 'email', 'User.Read'.- app-config.yamlfile fragment with optional- additionalScopesfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- sessionDuration
- Lifespan of the user session. Enter a duration in - mslibrary format (such as '24h', '2 days'), ISO duration, or "human duration" as used in code.- app-config-rhdh.yamlfragment with optional- sessionDurationfield- auth: providers: microsoft: production: sessionDuration: { hours: 24 }- auth: providers: microsoft: production: sessionDuration: { hours: 24 }- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- signIn
- resolvers
- 
												After successful authentication, the user signing in must be resolved to an existing user in the Developer Hub catalog. To best match users securely for your use case, consider configuring a specific resolver. Enter the resolver list to override the default resolver: emailLocalPartMatchingUserEntityName.
 - The authentication provider tries each sign-in resolver in order until it succeeds, and fails if none succeed. Warning- In production mode, only configure one resolver to ensure users are securely matched. - resolver
- Enter the sign-in resolver name. Available resolvers: - 
														userIdMatchingUserEntityAnnotation
- 
														emailLocalPartMatchingUserEntityName
- 
														emailMatchingUserEntityProfileEmail
 
- 
														
- dangerouslyAllowSignInWithoutUserInCatalog: true
- Configure the sign-in resolver to bypass the user provisioning requirement in the Developer Hub software catalog. Warning- Use - dangerouslyAllowSignInWithoutUserInCatalogto explore Developer Hub features, but do not use it in production.- app-config-rhdh.yamlfragment with optional field to allow signing in users absent from the software catalog- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
 
This step is optional for environments with outgoing access restrictions, such as firewall rules. If your environment has such restrictions, ensure that your RHDH backend can access the following hosts:
- 
							login.microsoftonline.com: For obtaining and exchanging authorization codes and access tokens.
- 
							graph.microsoft.com: For retrieving user profile information (as referenced in the source code). If this host is unreachable, you might see an Authentication failed, failed to fetch user profile error when attempting to log in.
4.2. Provisioning users from Microsoft Azure to the software catalog
To authenticate users with Microsoft Azure, after Enabling authentication with Microsoft Azure, provision users from Microsoft Azure to the Developer Hub software catalog.
Prerequisites
Procedure
- Enable the - backstage-plugin-catalog-backend-module-msgraph-dynamicplugin.- dynamic-plugins.yamlfile fragment- plugins: - package: './dynamic-plugins/dist/backstage-plugin-catalog-backend-module-msgraph-dynamic' disabled: false- plugins: - package: './dynamic-plugins/dist/backstage-plugin-catalog-backend-module-msgraph-dynamic' disabled: false- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- To enable Microsoft Azure member discovery, edit - app-config.yaml, your custom Developer Hub configuration file::- app-config.yamlfragment with mandatory- microsoftGraphOrgfields- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - target: https://graph.microsoft.com/v1.0
- Defines the MSGraph API endpoint the provider is connecting to. You might change this parameter to use a different version, such as the beta endpoint.
- tenandId,- clientIdand- clientSecret
- Use the Developer Hub application information you created in Microsoft Azure and configured in OpenShift as secrets.
- schedule
- frequency
- Enter the schedule frequency as cron, ISO duration, or human duration as used in code.
- timeout
- Enter the schedule timeout as ISO duration or human duration as used in code.
- initialDelay
- Enter the schedule initial delay as ISO duration or human duration as used in code. Tip- In a large organization, this plugin can take a long time. Therefore, avoid setting a low frequency or timeout when importing a large number of users and groups for the first time. 
 
 
				Optional: Consider adding the following optional microsoftGraphOrg.providerId fields:
			
- authority: https://login.microsoftonline.com
- Defines the authority used. Change the value to use a different authority, such as Azure US government. Default value: - https://login.microsoftonline.com.- app-config.yamlfragment with optional- queryModefield- catalog: providers: microsoftGraphOrg: providerId: authority: https://login.microsoftonline.com/- catalog: providers: microsoftGraphOrg: providerId: authority: https://login.microsoftonline.com/- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- queryMode: basic | advanced
- By default, the Microsoft Graph API only provides the - basicfeature set for querying. Certain features require- advancedquerying capabilities. See Microsoft Azure Advanced queries.- app-config.yamlfragment with optional- queryModefield- catalog: providers: microsoftGraphOrg: providerId: queryMode: advanced- catalog: providers: microsoftGraphOrg: providerId: queryMode: advanced- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- user.expand
- To include the expanded resource or collection referenced by a single relationship (navigation property) in your results. Only one relationship can be expanded in a single request. See Microsoft Graph query expand parameter. This parameter can be combined with ] or xref:userFilter[. - app-config.yamlfragment with optional- user.expandfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- user.filter
- To filter users. See Microsoft Graph API and Microsoft Graph API query filter parameters syntax. This parameter and ???TITLE??? are mutually exclusive, only one can be specified. - app-config.yamlfragment with optional- user.filterfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- user.loadPhotos: true | false
- Load photos by default. Set to - falseto not load user photos.- app-config.yamlfragment with optional- user.loadPhotosfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- user.select
- Define the Microsoft Graph resource types to retrieve. - app-config.yamlfragment with optional- user.selectfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- userGroupMember.filter
- To use group membership to get users. To filter groups and fetch their members. This parameter and ???TITLE??? are mutually exclusive, only one can be specified. - app-config.yamlfragment with optional- userGroupMember.filterfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- userGroupMember.search
- To use group membership to get users. To search for groups and fetch their members. This parameter and ???TITLE??? are mutually exclusive, only one can be specified. - app-config.yamlfragment with optional- userGroupMember.searchfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- group.expand
- Optional parameter to include the expanded resource or collection referenced by a single relationship (navigation property) in your results. Only one relationship can be expanded in a single request. See https://docs.microsoft.com/en-us/graph/query-parameters#expand-parameter This parameter can be combined with ] instead of xref:userFilter[. - app-config.yamlfragment with optional- group.expandfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- group.filter
- To filter groups. See Microsoft Graph API query group syntax. - app-config.yamlfragment with optional- group.filterfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- group.search
- To search for groups. See Microsoft Graph API query search parameter. - app-config.yamlfragment with optional- group.searchfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- group.select
- To define the Microsoft Graph resource types to retrieve. - app-config.yamlfragment with optional- group.selectfield- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
Verification
- Check the console logs to verify that the synchronization is completed. - Successful synchronization example: - backend:start: {"class":"MicrosoftGraphOrgEntityProvider$1","level":"info","message":"Read 1 msgraph users and 1 msgraph groups in 2.2 seconds. Committing...","plugin":"catalog","service":"backstage","taskId":"MicrosoftGraphOrgEntityProvider:default:refresh","taskInstanceId":"88a67ce1-c466-41a4-9760-825e16b946be","timestamp":"2024-06-26 12:23:42"} backend:start: {"class":"MicrosoftGraphOrgEntityProvider$1","level":"info","message":"Committed 1 msgraph users and 1 msgraph groups in 0.0 seconds.","plugin":"catalog","service":"backstage","taskId":"MicrosoftGraphOrgEntityProvider:default:refresh","taskInstanceId":"88a67ce1-c466-41a4-9760-825e16b946be","timestamp":"2024-06-26 12:23:42"}- backend:start: {"class":"MicrosoftGraphOrgEntityProvider$1","level":"info","message":"Read 1 msgraph users and 1 msgraph groups in 2.2 seconds. Committing...","plugin":"catalog","service":"backstage","taskId":"MicrosoftGraphOrgEntityProvider:default:refresh","taskInstanceId":"88a67ce1-c466-41a4-9760-825e16b946be","timestamp":"2024-06-26 12:23:42"} backend:start: {"class":"MicrosoftGraphOrgEntityProvider$1","level":"info","message":"Committed 1 msgraph users and 1 msgraph groups in 0.0 seconds.","plugin":"catalog","service":"backstage","taskId":"MicrosoftGraphOrgEntityProvider:default:refresh","taskInstanceId":"88a67ce1-c466-41a4-9760-825e16b946be","timestamp":"2024-06-26 12:23:42"}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Log in with a Microsoft Azure account.