Casdoor can use the OIDC protocol to link to a self-deployed GitLab server, and this document will show you how to do it.
As the GitLab docs state, GitLab only works with OpenID providers that use HTTPS, so you need to deploy Casdoor with HTTPS, such as putting Casdoor behind an NGINX reverse proxy with an SSL certificate setup. Casdoor itself only listens on port 8000 by default via HTTP and has no HTTPS-related functionality.
The following are some of the names mentioned in the configuration:
CASDOOR_HOSTNAME: The domain name or IP where the Casdoor server is deployed, e.g.,
GITLAB_HOSTNAME: The domain name or IP where GitLab is deployed, e.g.,
Step 1: Deploy Casdoor and GitLab
Firstly, Casdoor and GitLab should be deployed.
After a successful deployment, you need to ensure:
- Casdoor can be logged into and used normally.
- Set Casdoor's
originvalue (conf/app.conf) to
Step 2: Configure Casdoor application
- Create or use an existing Casdoor application.
- Add a redirect URL:
- Add the provider you want and supplement other settings.
Notably, you can get two values on the application settings page:
Client ID and
Client secret (see the picture above), and we will use them in the next step.
Open your favorite browser and visit: http://
CASDOOR_HOSTNAME/.well-known/openid-configuration, where you will see the OIDC configuration of Casdoor.
Step 3: Configure GitLab
You can follow the steps below to set this up, or make custom changes according to this document (e.g., if you are installing GitLab using source code rather than the Omnibus).
On your GitLab server, open the configuration file.
sudo editor /etc/gitlab/gitlab.rb
Add the provider configuration. (The HOSTNAME URL should include http or https)
gitlab_rails['omniauth_providers'] = [
label: "Casdoor", # optional label for the login button, defaults to "Openid Connect"
scope: ["openid", "profile", "email"],
identifier: "<YOUR CLIENT ID>",
secret: "<YOUR CLIENT SECRET>",
Reboot your GitLab server.
Each registered user can open
GITLAB_HOSTNAME/-/profile/account and connect the Casdoor account.
Finish. Now, you can log in to your own GitLab using Casdoor.