Catch an error when trying to generate an access token.
This commit is contained in:
parent
2e9f7cd19d
commit
3187539509
1 changed files with 8 additions and 4 deletions
|
@ -33,10 +33,14 @@ def generate_headers(role='read'):
|
|||
|
||||
if has_token_request:
|
||||
repo = model.get_repository(namespace, repository)
|
||||
if repo:
|
||||
token = model.create_access_token(repo, role)
|
||||
token_str = 'signature=%s' % token.code
|
||||
response.headers['WWW-Authenticate'] = token_str
|
||||
response.headers['X-Docker-Token'] = token_str
|
||||
else:
|
||||
logger.info('Token request in non-existing repo: %s/%s' %
|
||||
(namespace, repository))
|
||||
|
||||
return response
|
||||
return wrapper
|
||||
|
|
Reference in a new issue