Commit 64cf85ef authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Allow to use access_token in GitLab CI API

parent 9803f748
......@@ -2,14 +2,17 @@ module API
module Helpers
PRIVATE_TOKEN_PARAM = :private_token
PRIVATE_TOKEN_HEADER = "HTTP_PRIVATE_TOKEN"
ACCESS_TOKEN_PARAM = :access_token
ACCESS_TOKEN_HEADER = "HTTP_ACCESS_TOKEN"
UPDATE_RUNNER_EVERY = 60
def current_user
@current_user ||= begin
options = {
private_token: (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER])
access_token: (params[ACCESS_TOKEN_PARAM] || env[ACCESS_TOKEN_HEADER]),
private_token: (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]),
}
UserSession.new.authenticate(options)
UserSession.new.authenticate(options.compact)
end
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment