parent
5029ab62f6
commit
9c3ddf846f
7 changed files with 290 additions and 35 deletions
|
@ -6,6 +6,7 @@ import logging
|
|||
from flask import Blueprint, make_response, url_for, request, jsonify
|
||||
from functools import wraps
|
||||
from urlparse import urlparse
|
||||
from util import get_app_url
|
||||
|
||||
from app import metric_queue
|
||||
from endpoints.decorators import anon_protect, anon_allowed
|
||||
|
@ -69,12 +70,11 @@ def v2_support_enabled():
|
|||
|
||||
if get_grant_user_context() is None:
|
||||
response = make_response('true', 401)
|
||||
realm_hostname = urlparse(request.url).netloc
|
||||
realm_auth_path = url_for('v2.generate_registry_jwt')
|
||||
scheme = app.config['PREFERRED_URL_SCHEME']
|
||||
|
||||
authenticate = 'Bearer realm="{0}://{1}{2}",service="quay"'.format(scheme, realm_hostname,
|
||||
realm_auth_path)
|
||||
authenticate = 'Bearer realm="{0}{1}",service="{2}"'.format(get_app_url(app.config),
|
||||
realm_auth_path,
|
||||
app.config['SERVER_HOSTNAME'])
|
||||
response.headers['WWW-Authenticate'] = authenticate
|
||||
|
||||
response.headers['Docker-Distribution-API-Version'] = 'registry/2.0'
|
||||
|
|
Reference in a new issue