Casdoor集成市场

GitLab Self-Managed | 身份提供商

用 GitLab Self-Managed 登录 Casdoor

GitLab is also an OpenID Connect provider. Casdoor's built-in GitLab provider only talks to gitlab.com; this template points Casdoor at your own GitLab, so developers sign in with the account they already use every day.

Casdoor 官方核验OIDCPKCE自托管
你需要一个正在运行的 Casdoor,自己部署或用 Casdoor 云都可以。示例中的 https://auth.example.com 请换成你的 Casdoor 地址(Casdoor 云上类似 https://acme.casdoor.com),其他 example.com 地址也换成你自己的。

用 Casdoor 配置 GitLab Self-Managed

  1. 1

    Create an OAuth application in GitLab

    As an administrator, open Admin → Applications and click Add new application. (A group's Settings → Applications or your own Edit profile → Applications work too, without the Trusted option.) Fill in:

    NameCasdoor
    Redirect URIhttps://auth.example.com/callback
    TrustedOn, to skip the consent screen
    ConfidentialOn
    Scopesopenid, profile, email
  2. 2

    Copy the credentials

    Save the application and copy the Application ID (the client ID) and the Secret. GitLab stores the secret hashed, so this is the only time you can see it.

  3. 3

    在 Casdoor 中添加 GitLab Self-Managed 提供商

    在 Casdoor 控制台打开 提供商,点击 添加,填写:

    类别OAuth
    类型OIDC
    显示名称GitLab
    客户端ID<client ID>
    客户端密钥<client secret>
    Issuer链接https://gitlab.example.com
    认证URLhttps://gitlab.example.com/oauth/authorize
    Token链接https://gitlab.example.com/oauth/token
    范围openid profile email
    UserInfo链接https://gitlab.example.com/oauth/userinfo
    启用PKCE开启

    点击 Issuer链接 旁边的 请求,会从 GitLab Self-Managed 的 discovery 文档自动填好其余地址。同一个组织里所有 OIDC 类型的提供商都通过同一个字段关联用户,所以如果这个组织已经有一个 OIDC 提供商,请把 类型 改成 Custom Flexible,它按提供商分别关联账号。

  4. 4

    把提供商加到应用上

    打开 应用,编辑用户登录的那个应用,在它的 提供商 标签页添加这个提供商。之后登录页上就会出现 GitLab 按钮。

注意事项

  • GitLab only sends email for users who have a public email address. Others arrive in Casdoor without an email.
  • Renewing the secret in GitLab breaks sign-in until you put the new one in Casdoor.

GitLab Self-Managed 的设置取自它的官方文档(核对于 2026年10月:GitLab as an OpenID Connect provider、GitLab as an OAuth 2.0 provider、GitLab OAuth 2.0 API)。GitLab Self-Managed 是其所有者的商标。

常见问题

Does this work with gitlab.com?

Yes, with https://gitlab.com as the GitLab URL, but Casdoor's built-in GitLab provider already covers gitlab.com.

Do GitLab groups come over?

No. GitLab returns the user's groups from its userinfo endpoint, but Casdoor only fills in the standard profile from it, not Casdoor groups.