mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-02-06 06:39:24 +01:00
Page:
OpenID Connect Settings
Pages
API WebHook
Backup
Basic configurations
Build
Community Plugins
Connect to H2 database
Deployment to JEE and Servlet containers
Docker
Enabling SSH access to repository
External database configuration
FAQ
Home
How to Close Reference issues and pull request
Importing existing repos
Install as a systemd Service
Installation on IIS with Tomcat
Installation on Mac
Installation on a Raspberry Pi
Installation on ubuntu 16.04 with oracle_java8 tomcat8 mysql proper apache_proxy
LDAP Authentication Settings
List of URL Formats
OpenID Connect Settings
Performance
Reverse proxy with Apache
Reverse proxy with Caddy
Reverse proxy with Nginx
Setup Jenkins GitHub Branch Source plugin
Setup Jenkins GitHub pull request builder plugin
Setup Jenkins Multibranch Pipeline and Organization
Setup Slack Integration
Tomcat8 configuration
Tracing and logging
Wishlist
Clone
9
OpenID Connect Settings
Aaron Anderson edited this page 2023-11-02 10:41:14 -06:00
GitBucket supports the OpenID Connect authentication since 4.21.0.
Prerequisite
Check if your IdP (OpenID Provider) satisfies the followings:
- A client ID and client secret must be given by the IdP.
- The IdP must provide its metadata on
ISSUER_URL/.well-known/openid-configuration. - The IdP must provide an email address by the
emailclaim. - The IdP should provide full name of a user by the
nameclaim. - The IdP may provide a username by the
preferred_usernameclaim.
Getting Started
Google Identity Provider (Google Apps)
Setup the Google Identity Provider:
- Open https://console.developers.google.com/apis/credentials
- Create an OAuth client ID.
- Application type: web application
- Authorized redirect URIs:
http://localhost:8080/signin/oidc
- Check the client ID and client secret of the OAuth client.
Setup your GitBucket:
- Sign in as an administrator.
- Open the system settings.
- Turn on OpenID Connect and enter the followings:
- Issuer:
https://accounts.google.com - Client ID: See Google Identity Provider
- Client secret: See Google Identity Provider
- Expected signature algorithm: RS256
- Issuer:
- Sign out.
- Sign in with OpenID Connect.
Note that any Google users can sign in to your GitBucket. Make sure restricted people can access to your GitBucket.
See also https://developers.google.com/identity/protocols/OpenIDConnect.
Azure AD
Set up the Azure AD identity provider:
- In the Azure Active Directory admin center, go to
Overviewand copy theTenant IDfor later use below - From the
App registrationspane, clickNew registration - Enter the following info:
- Name: (e.g. "GitBucket")
- Supported account types: single tenant, all tenants, or global
- Redirect URI:
http://localhost:8080/signin/oidc
- Click
Register - From the
Overviewpane, copy theApplication (client) IDand save it for use below - From the
Certificates & secretspane, clickNew client secretand enter the following info:- Description: (e.g. "WebApp Server")
- Expires: 1 year, 2 years, or never
- Copy the automatically-generated key under the
Valuecolumn for later use below - From the
Token configurationpane, clickAdd optional claim, and select the following:- Token type: ID
- Claim: email
- Click the
Addbutton
Set up GitBucket:
- Sign in as an administrator
- Open
System settingsand click theAuthenticationtab - Check
OpenID Connectand enter the following:- Issuer:
https://sts.windows.net/[tenant-id-from-the-first-step]/(make sure to include the trailing slash) - Client ID: use the client ID copied from step 5
- Client secret: use the generated key from step 7
- Expected signature algorithm: RS256
- Issuer:
- Sign out.
- Sign in with OpenID Connect.
Keycloak
Setup your Keycloak:
- Create a new Client on your Keycloak.
- Client ID:
gitbucket - Client Protocol: OpenID Connect
- Valid redirect URIs:
http://localhost:8080/signin/oidc - Valid post logout redirect URIs:
http://localhost:8080 - Client authentication: On
- Client ID:
Setup your GitBucket:
- Sign in as an administrator.
- Open the system settings.
- Turn on OpenID Connect and enter the followings:
- Issuer:
https://keycloak.example.com/realms/YOUR_REALM(replacekeycloak.example.comwith your host name andYOUR_REALMwith your realm) - Client ID:
gitbucket - Client secret: See Credetials tab in Keycloak
- Expected signature algorithm: RS256
- Issuer:
- Sign out.
- Sign in with OpenID Connect.
How it works
GitBucket does the followings on the OpenID Connect authentication:
- Try to extract the username for the identity from:
- If the
preferred_usernameclaim is given, use it. - If the
emailclaim is given, use first part of it (before@).
- If the
- Check if the username already exists:
- If the username already exists, raise an error.
- If the username does not exist, create a user.
- Federate the user and the identity (i.e. the pair of
issandsubclaim). - Sign in as the user.
To migrate existing users from password login to federated login, entries must be added to the ACCOUNT_FEDERATION table that map the issuer and subject (sub) to the account in the ACCOUNT table.