diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-08-04 19:56:24 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-08-04 20:12:09 +0200 |
commit | 64cf85ef0afbefa61f22de2fa388284cf0051123 (patch) | |
tree | 6a01e380db20049e0d279064e8e8af968292cde8 /lib | |
parent | 9803f7489d612340019b3653b0cc0618a30a73f3 (diff) | |
download | gitlab-ci-64cf85ef0afbefa61f22de2fa388284cf0051123.tar.gz |
Allow to use access_token in GitLab CI API
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/helpers.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index cff5920..8ea7f86 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -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 |