we have discovered gitlab, and I would like to integrate it in our global authentication process, which relies on apache HTTP_REMOTE_USER environment variable.
I have seen very little documentation on it, so I am looking desperately for any help on how to do this. I would like to retrieve from the gitlab application the HTTP_REMOTE_USER variable and use it to authenticate my users.
I have tried to use omniauth and omniauth-ldap, but this returns only in Errors 500 in my server and seems to be a little bit overkill to only retrieve Apache HTTP_REMOTE_USER variable. What i am looking for is if such a feature simply exists, or if i am going to a wrong direction; if someone has some links to doc on it!
Many thanks for your answer! I had already add the RequestHeader in the apache configuration file (I am using as you apache as unicorn reverse proxy instead of nginx, and needed to forward the HTTP_REMOTE_USER to unicorn in the apache header). Then, I have applied the patch available here.
Unlike you, I am not using a ldap username/password authentication, but a kerberos authentication with ldap for autorisations. When I reach the gitlab web page, I can see on the logs that my authentification is granted, and gitlab retrieve from ldap my user attributes (email address). It even creates my account (as per allow_single_sign_on: true on /home/git/gitlab/config/gitlab.yml file). But then, it displays an error 500, with log message "error stack too deep".
I have then changed the file vendor/bundle/ruby/2.0.0/activesupport-3.2.13/lib/active_support/callbacks.rb to puts on a dummy file what is going on: (line 413)
def __reset_runner(symbol) f = File::open('/tmp/blah', 'a') f.write(caller(1,10)) f.close()
I then see that it recurses on a few functions (functions calling each others in an infinite loop). (Here is a period in /home/git/gitlab; first line repeats after last one):
vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:436:in `block in __update_callbacks' vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:433:in `each' vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:433:in `__update_callbacks' vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:502:in `set_callback' vendor/bundle/ruby/2.0.0/gems/activemodel-3.2.13/lib/active_model/callbacks.rb:110:in `before_save' vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/autosave_association.rb:189:in `add_autosave_association_callbacks' vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/autosave_association.rb:140:in `build' vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/builder/has_many.rb:10:in `build' vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/builder/collection_association.rb:13:in `build' vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations.rb:1198:in `has_many'
At this step, I really don't know how to fix this; it s far away from my RoR (none) and Ruby (few) knowledge. :/ Any help would be appreciated here!