Allow for anonymous access tokens for public repositories.
This commit is contained in:
parent
0652636693
commit
891f992bf2
3 changed files with 13 additions and 13 deletions
|
@ -28,11 +28,11 @@ def generate_headers(f):
|
|||
|
||||
has_token_request = request.headers.get('X-Docker-Token', '')
|
||||
|
||||
if has_token_request and get_authenticated_user():
|
||||
if has_token_request:
|
||||
repo = model.get_repository(namespace, repository)
|
||||
token = model.create_access_token(get_authenticated_user(), repo)
|
||||
token_str = 'signature=%s,repository="%s/%s"' % (token.code, namespace,
|
||||
repository)
|
||||
repository)
|
||||
response.headers['WWW-Authenticate'] = token_str
|
||||
response.headers['X-Docker-Token'] = token_str
|
||||
|
||||
|
|
Reference in a new issue