debian-mirror-gitlab/lib/gitlab/pages.rb

29 lines
743 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
module Gitlab
2020-10-24 23:57:45 +05:30
module Pages
2018-03-17 18:26:18 +05:30
VERSION = File.read(Rails.root.join("GITLAB_PAGES_VERSION")).strip.freeze
2021-04-29 21:17:54 +05:30
INTERNAL_API_REQUEST_HEADER = 'Gitlab-Pages-Api-Request'
2020-03-13 15:44:24 +05:30
MAX_SIZE = 1.terabyte
2019-12-04 20:38:33 +05:30
include JwtAuthenticatable
class << self
def verify_api_request(request_headers)
2022-03-02 08:16:31 +05:30
decode_jwt(request_headers[INTERNAL_API_REQUEST_HEADER], issuer: 'gitlab-pages')
2019-12-04 20:38:33 +05:30
rescue JWT::DecodeError
false
end
def secret_path
Gitlab.config.pages.secret_file
end
2020-03-13 15:44:24 +05:30
def access_control_is_forced?
::Gitlab.config.pages.access_control &&
::Gitlab::CurrentSettings.current_application_settings.force_pages_access_control
end
2019-12-04 20:38:33 +05:30
end
2018-03-17 18:26:18 +05:30
end
end