summaryrefslogtreecommitdiff
path: root/lib/gitlab/external_authorization/config.rb
blob: 8654a8c1e2e5c31cb6c056323c7113440bf10ee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# frozen_string_literal: true

module Gitlab
  module ExternalAuthorization
    module Config
      extend self

      def timeout
        application_settings.external_authorization_service_timeout
      end

      def service_url
        application_settings.external_authorization_service_url
      end

      def enabled?
        application_settings.external_authorization_service_enabled
      end

      def perform_check?
        enabled? && service_url.present?
      end

      def client_cert
        application_settings.external_auth_client_cert
      end

      def client_key
        application_settings.external_auth_client_key
      end

      def client_key_pass
        application_settings.external_auth_client_key_pass
      end

      def has_tls?
        client_cert.present? && client_key.present?
      end

      private

      def application_settings
        ::Gitlab::CurrentSettings.current_application_settings
      end
    end
  end
end