2018-10-22 03:00:50 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-04 16:52:00 -04:00
|
|
|
module Gitlab
|
2019-09-06 00:06:25 -04:00
|
|
|
class Pages
|
2017-09-04 16:52:00 -04:00
|
|
|
VERSION = File.read(Rails.root.join("GITLAB_PAGES_VERSION")).strip.freeze
|
2019-09-06 00:06:25 -04:00
|
|
|
INTERNAL_API_REQUEST_HEADER = 'Gitlab-Pages-Api-Request'.freeze
|
|
|
|
|
|
|
|
include JwtAuthenticatable
|
|
|
|
|
|
|
|
class << self
|
|
|
|
def verify_api_request(request_headers)
|
|
|
|
decode_jwt_for_issuer('gitlab-pages', request_headers[INTERNAL_API_REQUEST_HEADER])
|
|
|
|
rescue JWT::DecodeError
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def secret_path
|
|
|
|
Gitlab.config.pages.secret_file
|
|
|
|
end
|
|
|
|
end
|
2017-09-04 16:52:00 -04:00
|
|
|
end
|
|
|
|
end
|