mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-20 18:16:45 +10:00
If kerberos is enabled require it Since 'group: :kerberos' got [included in the Gemfile ](https://gitlab.com/gitlab-org/gitlab-ce/commit/2391a43a7073b4e723e9ca1f7ff19b30f8e51452) Kerberos no longer got [loaded when the app started](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/application.rb#L6) This caused `Devise::OmniAuth::StrategyNotFound` error once Kerberos is enabled, failing to start GitLab . With this we hopefully do not need to remove group from the Gemfile. See merge request !819
28 lines
905 B
Ruby
28 lines
905 B
Ruby
if Gitlab::LDAP::Config.enabled?
|
|
module OmniAuth::Strategies
|
|
server = Gitlab.config.ldap.servers.values.first
|
|
klass = server['provider_class']
|
|
const_set(klass, Class.new(LDAP)) unless klass == 'LDAP'
|
|
end
|
|
|
|
OmniauthCallbacksController.class_eval do
|
|
server = Gitlab.config.ldap.servers.values.first
|
|
alias_method server['provider_name'], :ldap
|
|
end
|
|
end
|
|
|
|
OmniAuth.config.allowed_request_methods = [:post]
|
|
#In case of auto sign-in, the GET method is used (users don't get to click on a button)
|
|
OmniAuth.config.allowed_request_methods << :get if Gitlab.config.omniauth.auto_sign_in_with_provider.present?
|
|
OmniAuth.config.before_request_phase do |env|
|
|
OmniAuth::RequestForgeryProtection.new(env).call
|
|
end
|
|
|
|
if Gitlab.config.omniauth.enabled
|
|
Gitlab.config.omniauth.providers.each do |provider|
|
|
if provider['name'] == 'kerberos'
|
|
require 'omniauth-kerberos'
|
|
end
|
|
end
|
|
end
|