OmniAuth SAML not allowing users to be created (ie. sign in via SSO without existing account)

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

Signing in to a self-hosted Gitlab EE instance using a SAML OmniAuth provider causes an error with this message: "Signing in using your SSO account without a pre-existing GitLab account is not allowed."

Steps to reproduce

  1. Install GitLab Omnibus with the following config:
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = true # also tried `= ['saml']`
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_providers'] = [
  {
    "name" => "saml",
    "label" => "SSO",
    "groups_attributes" => "roles",
    "required_groups" => ["access"],
    "external_groups" => ["external"],
    "admin_groups" => ["admin"],
    "auditor_groups" => ["audior"],
    "args" => {
      "assertion_consumer_service_url" => "https://git.mydomain.com/users/auth/saml/callback",
      "idp_cert_fingerprint" => "23:58:5A:C6:44:1D:5A:61:87:93:CB:03:01:E2:A0:0C:11:5F:4A:43",
      "idp_sso_target_url" => "https://keycloak.mydomain.com/auth/realms/girls/protocol/saml/clients/git.uselessbians.gay",
      "issuer" => "git.mydomain.com",
      "attribute_statements" => {
        "first_name" => ["first_name"],
        "last_name" => ["last_name"],
        "name" => ["name"],
        "username" => ["username"],
        "email" => ["email"]
      },
      "name_identifier_format" => "url:oasis:names:tc:SAML:2.0:nameid-format:persistent"
    }
  }
]
  1. Sign into GitLab with your SAML OmniAuth provider
  2. Get the error message I mentioned

What is the current bug behavior?

After signing in on the SAML provider, I get an error message saying I need a pre-existing GitLab account.

What is the expected correct behavior?

I get signed in to a brand new account.

Relevant logs and/or screenshots

image

Output of checks

Results of GitLab environment info

(domain changed in output below)

Expand for output related to GitLab environment info
System information
System:         Ubuntu 20.04
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   2.7.5p203
Gem Version:    3.1.4
Bundler Version:2.2.33
Rake Version:   13.0.6
Redis Version:  6.2.6
Sidekiq Version:6.4.0
Go Version:     unknown

GitLab information
Version:        15.0.0-ee
Revision:       3b397c17532
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     13.6
URL:            https://git.mydomain.com
HTTP Clone URL: https://git.mydomain.com/some-group/some-project.git
SSH Clone URL:  git@git.mydomain.com:some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers: saml

GitLab Shell
Version:        14.3.0
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 14.3.0 ? ... OK (14.3.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... 2/1 ... yes Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.5) Git user has default SSH configuration? ... yes Active users: ... 1 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... skipped (Advanced Search is disabled)

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Edited by 🤖 GitLab Bot 🤖