sameersbn / sameersbn/docker-gitlab

Using keycloak as sso provider always uses the same user to login

Open
#2,543 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
8.1k
Forks
2.1k
Avg merge
17h 47m
Merged PRs (30d)
7

Description

This is my configuration:

- OAUTH_ENABLED=true
- OAUTH_ALLOW_SSO=Keycloak
- OAUTH_BLOCK_AUTO_CREATED_USERS=false
- OAUTH_AUTO_LINK_LDAP_USER=false
- OAUTH_AUTO_LINK_SAML_USER=true

- OAUTH2_GENERIC_NAME=Keycloak
- OAUTH2_GENERIC_APP_ID=git
- OAUTH2_GENERIC_APP_SECRET=secret
- OAUTH2_GENERIC_CLIENT_SITE=https://url
- OAUTH2_GENERIC_CLIENT_USER_INFO_URL=https://url/realms/realm/protocol/openid-connect/userinfo
- OAUTH2_GENERIC_CLIENT_AUTHORIZE_URL=https://url/realms/realm/protocol/openid-connect/auth
- OAUTH2_GENERIC_CLIENT_TOKEN_URL=https://url/realms/realm/protocol/openid-connect/token
- OAUTH2_GENERIC_CLIENT_END_SESSION_ENDPOINT=https://url/realms/realm/protocol/openid-connect/logout

- OAUTH2_GENERIC_USER_UID=preferred_username
- OAUTH2_GENERIC_USER_NAME=name
- OAUTH2_GENERIC_USER_EMAIL=email

Everytime a keycloak user clicks the Keycloak button to login, he gets logged in with my user account.

For example:

John Doe => logs in via keycloak => gets Niklas Hanft as Gitlab user.

The user creation with sso should is enabled, but skipped when John Doe tries to login (he has no account yet)

Every other application I am using with keycloak does not behave this way, so I assume its an issue with the gitlab config.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the login flow with the listed OAUTH and OAUTH2_GENERIC environment variables, comparing the user information returned for different Keycloak accounts. Trace the generic OAuth/SSO configuration and verify that each Keycloak user maps to a distinct GitLab account, with account creation enabled for users who have no existing account.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.