website/integrations/development/github-enterprise-server/index.md
GitHub Enterprise Server is a self-hosted platform for software development within your enterprise. Your team can use GitHub Enterprise Server to build and ship software using Git version control, powerful APIs, productivity and collaboration tools, and integrations. Developers familiar with GitHub.com can onboard and contribute seamlessly using familiar features and workflows.
-- https://docs.github.com/en/[email protected]/admin/overview/about-github-enterprise-server
The following placeholders are used in this guide:
https://github.company is your GitHub Enterprise Server installationauthentik.company is the FQDN of the authentik installation.GitHub Users is an authentik group used for holding GitHub users.GitHub Admins is an authentik group used for indicating GitHub administrators.:::info This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application. :::
To support the integration of GitHub Enterprise Server with authentik, you need to create an application/provider pair in authentik.
:::info In order to use GitHub Enterprise Server, SCIM must also be set up. :::
https://github.company/saml/consume.https://github.company.Post.In the authentik Admin Interface, navigate to Directory > Groups and click Create. Set the group's name, any other desired settings, and click Create. Repeat this step twice: Once for the users group and once for the administrator group.
After creating the groups, select a group, navigate to the Users tab, and manage its members by using the Add existing user and Create user buttons as needed.
If you are planning to use SCIM, (available from GHES 3.14.0) you should create a first administrator user on your instance and go to your personal access tokens at https://github.company/settings/tokens/new, click Generate new token and click Generate new token (classic). Your token should have a descriptive name and ideally, no expiration date. For permission scopes, you need to select admin:enterprise. Click Generate token and store the resulting token in a safe location.
To enable SAML, navigate to your appliance maintenance settings. These are found at https://github.company:8443. Here, sign in with an administrator user and go to the Authentication section.
On this page:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress in the Username field to ensure the emails become normalized into usernames in GitHub.Once the appliance has saved the settings and reloaded the services, you should be able to navigate to your instance URL at https://github.company and sign in with SAML.
This section only applies if you have taken the steps prior to prepare the instance for SCIM enablement.
After enabling SAML, log into your initial administrator account again. Click the user portrait in tee top right, click Enterprise settings, click Settings in the left-hand sidebar, click Authentication security. On this page you have to check Enable SCIM configuration and press Save. After which you should get a message reading SCIM Enabled.
Before we create a SCIM provider, we have to create a new Property Mapping. In authentik, go to Customization, then Property Mappings. Here, click Create, select SCIM Provider Mapping. Name the mapping something memorable and paste the following code in the Expression field:
roles = []
# Edit this if statement if you need to add more GitHub roles.
# Valid roles include:
# user, guest_collaborator, enterprise_owner, billing_manager
if ak_is_group_member(request.user, name='GitHub Admins'):
roles.append({'value': 'enterprise_owner', 'primary': True})
else:
roles.append({'value': 'user', 'primary': True})
return {
"roles": roles,
}
If you named your group anything other than GitHub Admins, please ensure you change it in the code above.
Create a new SCIM provider with the following parameters:
https://github.company/api/v3/scim/v2GitHub Users group.authentik default SCIM Mapping: User mapping from the User Property Mappings by selecting it on the right-hand side and clicking the left-facing single chevron.authentik default SCIM Mapping: Group is the only one active in the Group Property Mappings.Go back to your GitHub Enterprise Server Application created in the first step and add your new SCIM provider in the Backchannel Providers field, then click the Update button.
You should now be ready to assign users to your GitHub Users and GitHub Admins groups, which will be provisioned by the SCIM provisioner. If you do not see your users being provisioned, go to your SCIM provider and click the Run sync again option. A few seconds later, you should see results of the SCIM sync.