Class: Gitlab::OmniauthInitializer
- Inherits:
-
Object
- Object
- Gitlab::OmniauthInitializer
- Defined in:
- lib/gitlab/omniauth_initializer.rb
Constant Summary collapse
- OAUTH2_TIMEOUT_SECONDS =
10
- ConfigurationError =
Class.new(StandardError)
Class Method Summary collapse
Instance Method Summary collapse
- #execute(providers) ⇒ Object
-
#initialize(devise_config) ⇒ OmniauthInitializer
constructor
A new instance of OmniauthInitializer.
Constructor Details
#initialize(devise_config) ⇒ OmniauthInitializer
Returns a new instance of OmniauthInitializer.
8 9 10 |
# File 'lib/gitlab/omniauth_initializer.rb', line 8 def initialize(devise_config) @devise_config = devise_config end |
Class Method Details
.default_arguments_for(provider_name) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/gitlab/omniauth_initializer.rb', line 22 def default_arguments_for(provider_name) case provider_name when 'shibboleth' { fail_with_empty_uid: true } when 'google_oauth2' { client_options: { connection_opts: { request: { timeout: OAUTH2_TIMEOUT_SECONDS } } } } when 'gitlab' { authorize_params: { gl_auth_type: 'login' } } when ->(provider_name) { AuthHelper.saml_providers.include?(provider_name.to_sym) } { attribute_statements: ::Gitlab::Auth::Saml::Config.default_attribute_statements } else {} end end |
.full_host ⇒ Object
39 40 41 |
# File 'lib/gitlab/omniauth_initializer.rb', line 39 def full_host proc { |_env| Settings.gitlab['base_url'] } end |
Instance Method Details
#execute(providers) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/gitlab/omniauth_initializer.rb', line 12 def execute(providers) providers.each do |provider| name = provider['name'].to_sym add_provider_to_devise(name, *arguments_for(provider)) setup_provider(name) end end |