summaryrefslogtreecommitdiff
path: root/lib/ci/api/helpers.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-12-15 16:24:14 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-12-15 16:24:14 +0100
commitd27befe64dd0d55bec2472ef641c4733cc669215 (patch)
tree623db3d658408b42d8b25e923eb9ccf68016d9fa /lib/ci/api/helpers.rb
parent447e598ec4ee0d2fae29303d4359ffe6a06d3ba5 (diff)
parent4493d3fd556af6ded47f940f258b0fc26c9eb3e8 (diff)
downloadgitlab-ce-d27befe64dd0d55bec2472ef641c4733cc669215.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into workhorse-passthrough
Diffstat (limited to 'lib/ci/api/helpers.rb')
-rw-r--r--lib/ci/api/helpers.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb
index 02502333756..443563c2e4a 100644
--- a/lib/ci/api/helpers.rb
+++ b/lib/ci/api/helpers.rb
@@ -6,22 +6,22 @@ module Ci
UPDATE_RUNNER_EVERY = 60
def authenticate_runners!
- forbidden! unless params[:token] == GitlabCi::REGISTRATION_TOKEN
+ forbidden! unless runner_registration_token_valid?
end
def authenticate_runner!
forbidden! unless current_runner
end
- def authenticate_project_token!(project)
- forbidden! unless project.valid_token?(params[:project_token])
- end
-
def authenticate_build_token!(build)
token = (params[BUILD_TOKEN_PARAM] || env[BUILD_TOKEN_HEADER]).to_s
forbidden! unless token && build.valid_token?(token)
end
+ def runner_registration_token_valid?
+ params[:token] == current_application_settings.ensure_runners_registration_token
+ end
+
def update_runner_last_contact
# Use a random threshold to prevent beating DB updates
contacted_at_max_age = UPDATE_RUNNER_EVERY + Random.rand(UPDATE_RUNNER_EVERY)