Using SAML

SAML is an XML-based standard for authentication and authorization. GitHub Enterprise Server can act as a service provider (SP) with your internal SAML identity provider (IdP).

Si quieres autenticar usuarios sin agregarlos a tu proveedor de identidad, puedes configurar la autenticación integrada. Para obtener más información, consulta "Permitir autenticación integrada para usuarios fuera de tu proveedor de identidad".

Supported SAML services

GitHub Enterprise Server es compatible con el SSO de SAML para los IdP que implementen SAML 2.0 estándar. Para obtener más información, consulta la sección Wiki de SAML en el sitio web de OASIS.

GitHub es oficialmente compatible con y prueba internamente los siguientes IdP.

  • Active Directory Federation Services (AD FS)
  • Azure Active Directory (Azure AD)
  • Okta
  • OneLogin
  • PingOne
  • Shibboleth

GitHub Enterprise Server no es compatible con el cierre de sesión único de SAML. Para terminar una sesión de SAML activa, los usuarios deben salir directamente en tu IdP de SAML.

Username considerations with SAML

Each GitHub Enterprise Server username is determined by one of the following assertions in the SAML response, ordered by priority:

  • The custom username attribute, if defined and present
  • An http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name assertion, if present
  • An http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress assertion, if present
  • The NameID element

The NameID element is required even if other attributes are present.

A mapping is created between the NameID and the GitHub Enterprise Server username, so the NameID should be persistent, unique, and not subject to change for the lifecycle of the user.

Note: If the NameID for a user does change on the IdP, the user will see an error message when they try to sign in to your GitHub Enterprise Server instance. To restore the user's access, you'll need to update the user account's NameID mapping. For more information, see "Updating a user's SAML NameID."

Los nombres de usuario del GitHub Enterprise Server únicamente pueden contener caracteres alfanuméricos y rayas (-). El GitHub Enterprise Server convertirá en raya cualquier caracter no alfanumérico en el nombre de tu cuenta de usuario. Por ejemplo, un nombre de usuario gregory.st.john se convertirá en gregory-st-john. Nota que los nombres de usuarios normalizados tampoco pueden comenzar o terminar con una raya. Tampoco pueden contener dos rayas seguidas.

Los nombres de usuarios creados a partir de direcciones de correo electrónico se crean con los caracteres normalizados que preceden al caracter @.

Si múltiples cuentas se normalizan en el mismo nombre de usuario de GitHub Enterprise Server, solo se crea la primera cuenta de usuario. Los siguientes usuarios con el mismo nombre de usuario no podrán registrarse.

Esta tabla brinda ejemplos de cómo se normalizan los nombres de usuarios en el GitHub Enterprise Server:

Nombre de usuarioNombre de usuario normalizadoResultado
Ms.Bubblesms-bubblesEl nombre de usuario se crea correctamente.
!Ms.Bubbles-ms-bubblesNo se crea este nombre de usuario debido a que comienza con una raya.
Ms.Bubbles!ms-bubbles-No se crea este nombre de usuario debido a que termina con una raya.
Ms!!Bubblesms--bubblesNo se crea este nombre de usuario debido a que contiene dos rayas seguidas.
Ms!Bubblesms-bubblesNo se crea este nombre de usuario. A pesar de que el nombre de usuario normalizado es válido, ya existía.
Ms.Bubbles@example.comms-bubblesNo se crea este nombre de usuario. A pesar de que el nombre de usuario normalizado es válido, ya existía.

Autenticación de dos factores

Cuando se utiliza SAML o CAS, la autenticación de dos factores no se admite o se administra en el aparato del GitHub Enterprise Server, pero es posible que lo admita un proveedor de autenticación externo. No está disponible la implementación de la autenticación de dos factores en organizaciones. Para obtener más información sobre cómo implementar la autenticación de dos factores, consulta "Requerir autenticación de dos factores en tu organización."

SAML metadata

Your GitHub Enterprise Server instance's service provider metadata is available at http(s)://[hostname]/saml/metadata.

To configure your identity provider manually, the Assertion Consumer Service (ACS) URL is http(s)://[hostname]/saml/consume. It uses the urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST binding.

SAML attributes

These attributes are available. You can change the attribute names in the management console, with the exception of the administrator attribute.

Default attribute nameTypeDescription
NameIDRequiredA persistent user identifier. Any persistent name identifier format may be used. The NameID element will be used for a GitHub Enterprise Server username unless one of the alternative assertions is provided.
administratorOptionalWhen the value is 'true', the user will automatically be promoted as an administrator. Any other value or a non-existent value will demote the user to a normal user account.
usernameOptionalThe GitHub Enterprise Server username.
full_nameOptionalThe name of the user displayed on their profile page. Users may change their names after provisioning.
emailsOptionalThe email addresses for the user. More than one can be specified.
public_keysOptionalThe public SSH keys for the user. More than one can be specified.
gpg_keysOptionalThe GPG keys for the user. More than one can be specified.

Configuring SAML settings

  1. Desde una cuenta administrativa en GitHub Enterprise Server, da clic en la esquina superior derecha de cualquier página. Ícono de cohete para acceder a las configuraciones de administrador del sitio

  2. En la barra lateral izquierda, haz clic en Consola de administración. pestaña Consola de administración en la barra lateral izquierda

  3. En la barra lateral izquierda, da clic en Autenticación. Pestaña de autenticación en la barra lateral de configuración

  4. Select SAML. SAML authentication

  5. Opcionalmente, selecciona Permitir autenticación integrada para invitar a los usuarios a utilizar la autenticación integrada si no pertenecen a el proveedor de identidad de tu instancia de GitHub Enterprise Server. Select SAML built-in authentication checkbox

  6. Optionally, to enable unsolicited response SSO, select IdP initiated SSO. By default, GitHub Enterprise Server will reply to an unsolicited Identity Provider (IdP) initiated request with an AuthnRequest back to the IdP. SAML idP SSO

    Note: We recommend keeping this value unselected. You should enable this feature only in the rare instance that your SAML implementation does not support service provider initiated SSO, and when advised by Soporte para GitHub Enterprise.

  7. Select Disable administrator demotion/promotion if you do not want your SAML provider to determine administrator rights for users on tu instancia de GitHub Enterprise Server. SAML disable admin configuration

  8. In the Single sign-on URL field, type the HTTP or HTTPS endpoint on your IdP for single sign-on requests. This value is provided by your IdP configuration. If the host is only available from your internal network, you may need to configure tu instancia de GitHub Enterprise Server to use internal nameservers. SAML authentication

  9. Optionally, in the Issuer field, type your SAML issuer's name. This verifies the authenticity of messages sent to tu instancia de GitHub Enterprise Server. SAML issuer

  10. In the Signature Method and Digest Method drop-down menus, choose the hashing algorithm used by your SAML issuer to verify the integrity of the requests from tu instancia de GitHub Enterprise Server. Specify the format with the Name Identifier Format drop-down menu. SAML method

  11. Under Verification certificate, click Choose File and choose a certificate to validate SAML responses from the IdP. SAML authentication

  12. Modify the SAML attribute names to match your IdP if needed, or accept the default names. SAML attribute names

Updating a user's SAML NameID

  1. Desde una cuenta administrativa en GitHub Enterprise Server, da clic en la esquina superior derecha de cualquier página. Ícono de cohete para acceder a las configuraciones de administrador del sitio
  2. In the left sidebar, click All users. "All users" sidebar item in site administrator settings
  3. In the list of users, click the username you'd like to update the NameID mapping for. Username in list of instance user accounts
  4. En la esquina superior derecha de la página, haz clic en Security (Seguridad). Pestaña de seguridad
  5. To the right of "Update SAML NameID", click Edit . "Edit" button under "SAML authentication" and to the right of "Update SAML NameID"
  6. In the "NameID" field, type the new NameID for the user. "NameID" field in modal dialog with NameID typed
  7. Click Update NameID. "Update NameID" button under updated NameID value within modal

Revoking access to tu instancia de GitHub Enterprise Server

If you remove a user from your identity provider, you must also manually suspend them. Otherwise, they'll continue to be able to authenticate using access tokens or SSH keys. For more information, see "Suspending and unsuspending users".

Response message requirements

The response message must fulfill the following requirements:

  • The <Destination> element must be provided on the root response document and match the ACS URL only when the root response document is signed. If the assertion is signed, it will be ignored.
  • The <Audience> element must always be provided as part of the <AudienceRestriction> element. It must match the EntityId for GitHub Enterprise Server. This is the URL to the GitHub Enterprise Server instance, such as https://ghe.corp.example.com.
  • Each assertion in the response must be protected by a digital signature. This can be accomplished by signing each individual <Assertion> element or by signing the <Response> element.
  • A <NameID> element must be provided as part of the <Subject> element. Any persistent name identifier format may be used.
  • The Recipient attribute must be present and set to the ACS URL. For example:
<samlp:Response ...>
  <saml:Assertion ...>
    <saml:Subject>
      <saml:NameID ...>...</saml:NameID>
      <saml:SubjectConfirmation ...>
        <saml:SubjectConfirmationData Recipient="https://ghe.corp.example.com/saml/consume" .../>
      </saml:SubjectConfirmation>
    </saml:Subject>
    <saml:AttributeStatement>
      <saml:Attribute FriendlyName="USERNAME-ATTRIBUTE" ...>
        <saml:AttributeValue>monalisa</saml:AttributeValue>
      </saml:Attribute>
    </saml:AttributeStatement>
  </saml:Assertion>
</samlp:Response>

Troubleshooting SAML authentication

GitHub Enterprise Server logs error messages for failed SAML authentication in the authentication log at /var/log/github/auth.log. For more information about SAML response requirements, see "Response message requirements."

Error: "Another user already owns the account"

When a user signs in to GitHub Enterprise Server for the first time with SAML authentication, GitHub Enterprise Server creates a user account on the instance and maps the SAML NameID to the account.

When the user signs in again, GitHub Enterprise Server compares the account's NameID mapping to the IdP's response. If the NameID in the IdP's response no longer matches the NameID that GitHub Enterprise Server expects for the user, the sign-in will fail. The user will see the following message.

Another user already owns the account. Please have your administrator check the authentication log.

The message typically indicates that the person's username or email address has changed on the IdP. Ensure that the NameID mapping for the user account on GitHub Enterprise Server matches the user's NameID on your IdP. For more information, see "Updating a user's SAML NameID."

Error: Recipient in SAML response was blank or not valid

If the Recipient does not match the ACS URL for your GitHub Enterprise Server instance, one of the following two error messages will appear in the authentication log when a user attempts to authenticate.

Recipient in the SAML response must not be blank.
Recipient in the SAML response was not valid.

Ensure that you set the value for Recipient on your IdP to the full ACS URL for your GitHub Enterprise Server instance. For example, https://ghe.corp.example.com/saml/consume.

Error: "SAML Response is not signed or has been modified"

If your IdP does not sign the SAML response, or the signature does not match the contents, the following error message will appear in the authentication log.

SAML Response is not signed or has been modified.

Ensure that you configure signed assertions for the GitHub Enterprise Server application on your IdP.

Error: "Audience is invalid" or "No assertion found"

If the IdP's response has a missing or incorrect value for Audience, the following error message will appear in the authentication log.

Audience is invalid. Audience attribute does not match https://YOUR-INSTANCE-URL

Ensure that you set the value for Audience on your IdP to the EntityId for your GitHub Enterprise Server instance, which is the full URL to your GitHub Enterprise Server instance. For example, https://ghe.corp.example.com.

¿Te ayudó este documento?

Política de privacidad

¡Ayúdanos a hacer geniales estos documentos!

Todos los documentos de GitHub son de código abierto. ¿Notas algo que esté mal o que no sea claro? Emite una solicitud de cambios.

Haz una contribución

O, aprende cómo contribuir.