Enable authentication with GitHub
Configure GitHub as your Red Hat Developer Hub sign-in provider.
Before you begin
- You have shared secrets with GitHub.
- You have provisioned users and groups to the software catalog.
Procedure
-
Enable the GitHub authentication provider plugin in your
dynamic-plugins.yamlfile:plugins: - package: oci://quay.io/rhdh/backstage-plugin-auth-backend-module-github-provider:{{inherit}} enabled: true -
Add a GitHub authentication provider section to your
app-config.yamlfile:auth: environment: production providers: github: production: clientId: ${GITHUB_APP_CLIENT_ID} clientSecret: ${GITHUB_APP_CLIENT_SECRET} signInPage: github-
environment - Enter
productionto disable the Guest login option in the Developer Hub login page. -
clientId - Enter the configured secret variable name:
${GITHUB_APP_CLIENT_ID}. -
clientSecret - Enter the configured secret variable name:
${GITHUB_APP_CLIENT_SECRET}. -
signInPage - Enter
githubto enable the GitHub provider as your Developer Hub sign-in provider.
-
-
Optional: Add optional fields to the GitHub authentication provider section in your
app-config.yamlfile:auth: environment: production providers: github: production: clientId: ${GITHUB_APP_CLIENT_ID} clientSecret: ${GITHUB_APP_CLIENT_SECRET} callbackUrl: <your_intermediate_service_url/handler> sessionDuration: { hours: 24 } signIn: resolvers: - resolver: userIdMatchingUserEntityAnnotation dangerouslyAllowSignInWithoutUserInCatalog: true signInPage: github-
callbackUrl - Enter 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.
-
sessionDuration - Enter the user session lifespan, in
mslibrary format (such as '24h', '2 days'), ISO duration, or "human duration". -
signIn -
-
resolvers -
After successful authentication, Developer Hub resolves the user signing in to an existing user in the Developer Hub catalog. Configure a specific resolver to best match users securely for your use case..
Enter the resolver list to override the default resolver:
userIdMatchingUserEntityAnnotation.The authentication provider tries each sign-in resolver in order until it succeeds. If none of the attempts succeed, the sign-in fails.
Warning In production mode, configure only one resolver to make sure users are securely matched.
-
resolver - Enter the sign-in resolver name. Available resolvers:
userIdMatchingUserEntityAnnotation,preferredUsernameMatchingUserEntityName,emailMatchingUserEntityProfileEmail. -
dangerouslyAllowSignInWithoutUserInCatalog -
Enter
trueto configure the sign-in resolver to bypass the user provisioning requirement in the Developer Hub software catalog.Warning In production mode, do not enable
dangerouslyAllowSignInWithoutUserInCatalog.
-
-
-
-
To disable the guest login option, in the
app-config.yamlfile, set the authentication environment toproduction:auth: environment: production
Results
- 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 a GitHub account.