diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-31 13:48:05 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-31 13:48:05 +0200 |
commit | 7b0e2bbc803f1dff96941875a541e80675931828 (patch) | |
tree | 78db08f8948b21d2017f5b27423dc4f20c7cb570 | |
parent | 041b0215071b4211400dfebb38fe24bc2718dda3 (diff) | |
download | gitlab-ce-7b0e2bbc803f1dff96941875a541e80675931828.tar.gz |
Fix the use of CurrentSettings in ContainerRegistryAuthenticationService
-rw-r--r-- | app/services/auth/container_registry_authentication_service.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb index 56e567c9eed..e57b95f21ec 100644 --- a/app/services/auth/container_registry_authentication_service.rb +++ b/app/services/auth/container_registry_authentication_service.rb @@ -1,6 +1,6 @@ module Auth class ContainerRegistryAuthenticationService < BaseService - include CurrentSettings + include Gitlab::CurrentSettings AUDIENCE = 'container_registry' @@ -19,7 +19,7 @@ module Auth token = JSONWebToken::RSAToken.new(registry.key) token.issuer = registry.issuer token.audience = AUDIENCE - token.expire_time = token.issued_at + current_application_settings.container_registry_token_expire_delay.minutes + token.expire_time = token_expire_at token[:access] = names.map do |name| { type: 'repository', name: name, actions: %w(*) } end @@ -33,6 +33,7 @@ module Auth token.issuer = registry.issuer token.audience = params[:service] token.subject = current_user.try(:username) + token.expire_time = ContainerRegistryAuthenticationService.token_expire_at token[:access] = accesses.compact token end @@ -78,5 +79,9 @@ module Auth def registry Gitlab.config.registry end + + def self.token_expire_at + Time.now + current_application_settings.container_registry_token_expire_delay.minutes + end end end |