Define LDAP omniauth_callbacks route only from GitLab config
What does this MR do and why?
I found that the route definition for LDAP omniauth_callbacks
involves a database call which is not ideal. So rather then using the database,
we always define the routes, and use the controller instead of enforce the multiple_ldap_servers
licensed feature.
Related issue: #359913 (closed), !92075 (merged)
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
LDAP still works:
Started POST "/users/auth/ldapmain/callback" for 127.0.0.1 at 2022-07-14 16:48:51 +1200
Processing by Ldap::OmniauthCallbacksController#ldapmain as HTML
Parameters: {"authenticity_token"=>"[FILTERED]", "username"=>"john", "password"=>"[FILTERED]"}
Redirected to http://127.0.0.1:3000/
Completed 302 Found in 118ms (ActiveRecord: 5.1ms | Elasticsearch: 0.0ms | Allocations: 117111)
Processing by Ldap::OmniauthCallbacksController#ldapalt as HTML
Parameters: {"authenticity_token"=>"[FILTERED]", "username"=>"bob", "password"=>"[FILTERED]"}
Redirected to http://127.0.0.1:3000/
Completed 302 Found in 388ms (ActiveRecord: 10.4ms | Elasticsearch: 0.0ms | Allocations: 220491)
How to set up and validate locally
- Follow https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/ldap.md to validate LDAP login still works
- You may encounter an error because the
.cache/
directory does not exist in GDK root while creating GDK creates.cache/gitlab-openldap_ldap-users-created
. In this case, the workaround is to manually create that directory
- You may encounter an error because the
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Thong Kuah