Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
c4f1e8ed
Commit
c4f1e8ed
authored
Feb 11, 2019
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move LFS auth hash creation into GitLab::LfsToken
parent
9ab268b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
lib/api/internal.rb
lib/api/internal.rb
+1
-7
lib/gitlab/lfs_token.rb
lib/gitlab/lfs_token.rb
+8
-0
spec/lib/gitlab/lfs_token_spec.rb
spec/lib/gitlab/lfs_token_spec.rb
+14
-0
No files found.
lib/api/internal.rb
View file @
c4f1e8ed
...
...
@@ -117,13 +117,7 @@ module API
raise
ActiveRecord
::
RecordNotFound
.
new
(
"No key_id or user_id passed!"
)
end
token_handler
=
Gitlab
::
LfsToken
.
new
(
actor
)
{
username:
token_handler
.
actor_name
,
lfs_token:
token_handler
.
token
,
repository_http_path:
project
.
http_url_to_repo
}
Gitlab
::
LfsToken
.
new
(
actor
).
for_gitlab_shell
(
project
.
http_url_to_repo
)
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
lib/gitlab/lfs_token.rb
View file @
c4f1e8ed
...
...
@@ -47,6 +47,14 @@ module Gitlab
user?
?
:lfs_token
:
:lfs_deploy_token
end
def
for_gitlab_shell
(
repository_http_path
)
{
username:
actor_name
,
lfs_token:
token
,
repository_http_path:
repository_http_path
}
end
private
# rubocop:disable Lint/UselessAccessModifier
class
HMACToken
...
...
spec/lib/gitlab/lfs_token_spec.rb
View file @
c4f1e8ed
...
...
@@ -226,4 +226,18 @@ describe Gitlab::LfsToken, :clean_gitlab_redis_shared_state do
end
end
end
describe
'#for_gitlab_shell'
do
let
(
:actor
)
{
create
(
:user
)
}
let
(
:lfs_token
)
{
described_class
.
new
(
actor
)
}
let
(
:repo_http_path
)
{
'http://localhost/user/repo.git'
}
it
'returns a Hash desgined for gitlab-shell'
do
hash
=
lfs_token
.
for_gitlab_shell
(
repo_http_path
)
expect
(
hash
[
:username
]).
to
eq
(
actor
.
username
)
expect
(
hash
[
:repository_http_path
]).
to
eq
(
repo_http_path
)
expect
(
hash
[
:lfs_token
]).
to
be_a
String
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment