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.
https://auth.example.com 请换成你的 Casdoor 地址(Casdoor 云上类似 https://acme.casdoor.com),其他 example.com 地址也换成你自己的。用 Casdoor 配置 GitLab Self-Managed
- 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:
Name Casdoor Redirect URI https://auth.example.com/callback Trusted On, to skip the consent screen Confidential On Scopes openid, profile, email - 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
在 Casdoor 中添加 GitLab Self-Managed 提供商
在 Casdoor 控制台打开 提供商,点击 添加,填写:
类别 OAuth 类型 OIDC 显示名称 GitLab 客户端ID <client ID> 客户端密钥 <client secret> Issuer链接 https://gitlab.example.com 认证URL https://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
把提供商加到应用上
打开 应用,编辑用户登录的那个应用,在它的 提供商 标签页添加这个提供商。之后登录页上就会出现 GitLab 按钮。
注意事项
- GitLab only sends
emailfor 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.
更多身份提供商
查看全部Authelia
身份提供商Let people sign in to Casdoor through Authelia over OpenID Connect: the provider settings, and the client to add to Authelia's configuration.
authentik
身份提供商Let people sign in to Casdoor with their authentik accounts over OpenID Connect: the provider settings, and the application and OAuth2 provider to create in authentik.
Keycloak
身份提供商Let people sign in to Casdoor with their Keycloak accounts over OpenID Connect: the provider settings for a Keycloak realm, and the client to create on the Keycloak side.
