diff options
author | Valery Sizov <valery@gitlab.com> | 2019-08-01 15:03:08 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2019-08-01 20:38:07 +0300 |
commit | f519a4b72f81a1e3c81e5e684d236bbe30e0dd2d (patch) | |
tree | 469cbc073884f0a8f30ae7fd474b699c4ac47c13 /app/services/auth | |
parent | beb7d8922746942f1f4108108b04859ba61ea1ea (diff) | |
download | gitlab-ce-f519a4b72f81a1e3c81e5e684d236bbe30e0dd2d.tar.gz |
Backport of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/3809ce-docker_image_replication
Introducing Docker Registry replication
Diffstat (limited to 'app/services/auth')
-rw-r--r-- | app/services/auth/container_registry_authentication_service.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb index 707caee482c..0a069320936 100644 --- a/app/services/auth/container_registry_authentication_service.rb +++ b/app/services/auth/container_registry_authentication_service.rb @@ -17,6 +17,14 @@ module Auth end def self.full_access_token(*names) + access_token(%w(*), names) + end + + def self.pull_access_token(*names) + access_token(['pull'], names) + end + + def self.access_token(actions, names) names = names.flatten registry = Gitlab.config.registry token = JSONWebToken::RSAToken.new(registry.key) @@ -25,7 +33,7 @@ module Auth token.expire_time = token_expire_at token[:access] = names.map do |name| - { type: 'repository', name: name, actions: %w(*) } + { type: 'repository', name: name, actions: actions } end token.encoded |