Add a feature flag for disabling unauthenticated access to the registry in its entirety.

This commit is contained in:
Joseph Schorr 2015-05-19 17:52:44 -04:00
parent 598fc6ec46
commit 54992c23b7
15 changed files with 147 additions and 25 deletions

View file

@ -19,6 +19,7 @@ from auth import scopes
from auth.auth_context import get_authenticated_user, get_validated_oauth_token
from auth.auth import process_oauth
from endpoints.csrf import csrf_protect
from endpoints.decorators import anon_protect
logger = logging.getLogger(__name__)
@ -228,12 +229,14 @@ def parse_repository_name(func):
class ApiResource(Resource):
method_decorators = [anon_protect]
def options(self):
return None, 200
class RepositoryParamResource(ApiResource):
method_decorators = [parse_repository_name]
method_decorators = [anon_protect, parse_repository_name]
def require_repo_permission(permission_class, scope, allow_public=False):