Module: Gitlab::Kas

Includes:
JwtAuthenticatable
Defined in:
lib/gitlab/kas.rb

Constant Summary collapse

INTERNAL_API_REQUEST_HEADER =
'Gitlab-Kas-Api-Request'
JWT_ISSUER =
'gitlab-kas'

Constants included from JwtAuthenticatable

JwtAuthenticatable::SECRET_LENGTH

Class Method Summary collapse

Methods included from JwtAuthenticatable

included

Class Method Details

.ensure_secret!Object


21
22
23
24
25
# File 'lib/gitlab/kas.rb', line 21

def ensure_secret!
  return if File.exist?(secret_path)

  write_secret
end

.secret_pathObject


17
18
19
# File 'lib/gitlab/kas.rb', line 17

def secret_path
  Gitlab.config.gitlab_kas.secret_file
end

.verify_api_request(request_headers) ⇒ Object


11
12
13
14
15
# File 'lib/gitlab/kas.rb', line 11

def verify_api_request(request_headers)
  decode_jwt_for_issuer(JWT_ISSUER, request_headers[INTERNAL_API_REQUEST_HEADER])
rescue JWT::DecodeError
  nil
end