diff options
author | Nick Thomas <nick@gitlab.com> | 2019-10-14 16:00:48 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-10-15 07:44:13 +0100 |
commit | 18096b5440e0818605add32538751c6be38e8343 (patch) | |
tree | b4aebac9d7f752156ee4ec3d44ee990021a1b295 /lib/gitlab_lfs_authentication.rb | |
parent | 8db304b4919519bca60a5b18ffe9b88dcde845af (diff) | |
download | gitlab-shell-18096b5440e0818605add32538751c6be38e8343.tar.gz |
Remove dead Ruby code
Diffstat (limited to 'lib/gitlab_lfs_authentication.rb')
-rw-r--r-- | lib/gitlab_lfs_authentication.rb | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/lib/gitlab_lfs_authentication.rb b/lib/gitlab_lfs_authentication.rb deleted file mode 100644 index 574dc98..0000000 --- a/lib/gitlab_lfs_authentication.rb +++ /dev/null @@ -1,43 +0,0 @@ -require 'base64' -require 'json' - -class GitlabLfsAuthentication - # TODO: These don't need to be public - attr_accessor :username, :lfs_token, :repository_http_path - - def initialize(username, lfs_token, repository_http_path, expires_in = nil) - @username = username - @lfs_token = lfs_token - @repository_http_path = repository_http_path - @expires_in = expires_in - end - - def self.build_from_json(json) - values = JSON.parse(json) - new(values['username'], - values['lfs_token'], - values['repository_http_path'], - values['expires_in']) - rescue - nil - end - - # Source: https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md#ssh - # - def authentication_payload - payload = { header: { Authorization: authorization }, href: href } - payload[:expires_in] = @expires_in if @expires_in - - JSON.generate(payload) - end - - private - - def authorization - "Basic #{Base64.strict_encode64("#{username}:#{lfs_token}")}" - end - - def href - "#{repository_http_path}/info/lfs" - end -end |