diff --git a/auth/process.py b/auth/decorators.py similarity index 100% rename from auth/process.py rename to auth/decorators.py diff --git a/endpoints/api/__init__.py b/endpoints/api/__init__.py index f7e23eba5..0e876f21b 100644 --- a/endpoints/api/__init__.py +++ b/endpoints/api/__init__.py @@ -19,7 +19,7 @@ from auth.permissions import (ReadRepositoryPermission, ModifyRepositoryPermissi UserAdminPermission) from auth import scopes from auth.auth_context import get_authenticated_user, get_validated_oauth_token -from auth.process import process_oauth +from auth.decorators import process_oauth from endpoints.csrf import csrf_protect from endpoints.exception import (ApiException, Unauthorized, InvalidRequest, InvalidResponse, FreshLoginRequired, NotFound) diff --git a/endpoints/bitbuckettrigger.py b/endpoints/bitbuckettrigger.py index ba2e5b215..e58f04db2 100644 --- a/endpoints/bitbuckettrigger.py +++ b/endpoints/bitbuckettrigger.py @@ -4,7 +4,7 @@ from flask import request, redirect, url_for, Blueprint from flask_login import current_user from app import app -from auth.process import require_session_login +from auth.decorators import require_session_login from buildtrigger.basehandler import BuildTriggerHandler from buildtrigger.bitbuckethandler import BitbucketBuildTrigger from data import model diff --git a/endpoints/githubtrigger.py b/endpoints/githubtrigger.py index 7b4b12bb0..416df8842 100644 --- a/endpoints/githubtrigger.py +++ b/endpoints/githubtrigger.py @@ -6,8 +6,8 @@ from flask_login import current_user import features from app import app, github_trigger +from auth.decorators import require_session_login from auth.permissions import AdministerRepositoryPermission -from auth.process import require_session_login from data import model from endpoints.common import route_show_if, parse_repository_name from util.http import abort diff --git a/endpoints/gitlabtrigger.py b/endpoints/gitlabtrigger.py index 9f0f395c1..e1bb31001 100644 --- a/endpoints/gitlabtrigger.py +++ b/endpoints/gitlabtrigger.py @@ -6,8 +6,8 @@ from flask_login import current_user import features from app import app, gitlab_trigger +from auth.decorators import require_session_login from auth.permissions import AdministerRepositoryPermission -from auth.process import require_session_login from data import model from endpoints.common import route_show_if from util.http import abort diff --git a/endpoints/oauth/login.py b/endpoints/oauth/login.py index f1c32917f..333f4e99d 100644 --- a/endpoints/oauth/login.py +++ b/endpoints/oauth/login.py @@ -8,7 +8,7 @@ import features from app import app, analytics, get_app_url, oauth_login, authentication from auth.auth_context import get_authenticated_user -from auth.process import require_session_login +from auth.decorators import require_session_login from data import model from endpoints.common import common_login from endpoints.web import index diff --git a/endpoints/realtime.py b/endpoints/realtime.py index cc113da0c..c1a594d4d 100644 --- a/endpoints/realtime.py +++ b/endpoints/realtime.py @@ -5,7 +5,7 @@ from flask import request, Blueprint, abort, Response from flask_login import current_user from app import userevents -from auth.process import require_session_login +from auth.decorators import require_session_login from data.userevent import CannotReadUserEventsException diff --git a/endpoints/v1/index.py b/endpoints/v1/index.py index 2b5f6245f..51f68408f 100644 --- a/endpoints/v1/index.py +++ b/endpoints/v1/index.py @@ -9,10 +9,10 @@ from flask import request, make_response, jsonify, session from data.interfaces.v1 import pre_oci_model as model from app import authentication, userevents, metric_queue from auth.auth_context import get_authenticated_user, get_validated_token, get_validated_oauth_token +from auth.decorators import process_auth, generate_signed_token from auth.permissions import (ModifyRepositoryPermission, UserAdminPermission, ReadRepositoryPermission, CreateRepositoryPermission, repository_read_grant, repository_write_grant) -from auth.process import process_auth, generate_signed_token from util.http import abort from util.names import REPOSITORY_NAME_REGEX from endpoints.common import parse_repository_name diff --git a/endpoints/v1/registry.py b/endpoints/v1/registry.py index 8cabb0507..845fd464a 100644 --- a/endpoints/v1/registry.py +++ b/endpoints/v1/registry.py @@ -9,9 +9,9 @@ from flask import make_response, request, session, Response, redirect, abort as from app import storage as store, app, metric_queue from auth.auth_context import get_authenticated_user +from auth.decorators import extract_namespace_repo_from_session, process_auth from auth.permissions import (ReadRepositoryPermission, ModifyRepositoryPermission) -from auth.process import process_auth, extract_namespace_repo_from_session from auth.registry_jwt_auth import get_granted_username from data import model, database from data.interfaces.v1 import pre_oci_model as model diff --git a/endpoints/v1/tag.py b/endpoints/v1/tag.py index 73eed61ee..ce3726374 100644 --- a/endpoints/v1/tag.py +++ b/endpoints/v1/tag.py @@ -5,9 +5,9 @@ from flask import abort, request, jsonify, make_response, session from util.names import TAG_ERROR, TAG_REGEX +from auth.decorators import process_auth from auth.permissions import (ReadRepositoryPermission, ModifyRepositoryPermission) -from auth.process import process_auth from data import model from data.interfaces.v1 import pre_oci_model as model from endpoints.common import parse_repository_name diff --git a/endpoints/v2/v2auth.py b/endpoints/v2/v2auth.py index 9478ae785..c9f0dc960 100644 --- a/endpoints/v2/v2auth.py +++ b/endpoints/v2/v2auth.py @@ -6,6 +6,7 @@ from flask import request, jsonify, abort from app import app, userevents, instance_keys from auth.auth_context import get_authenticated_user, get_validated_token, get_validated_oauth_token +from auth.decorators import process_auth from auth.permissions import (ModifyRepositoryPermission, ReadRepositoryPermission, CreateRepositoryPermission, AdministerRepositoryPermission) from auth.process import process_auth diff --git a/endpoints/verbs/__init__.py b/endpoints/verbs/__init__.py index 1c6f0af92..8e784aedb 100644 --- a/endpoints/verbs/__init__.py +++ b/endpoints/verbs/__init__.py @@ -7,8 +7,8 @@ import features from app import app, signer, storage, metric_queue, license_validator from auth.auth_context import get_authenticated_user +from auth.decorators import process_auth from auth.permissions import ReadRepositoryPermission -from auth.process import process_auth from data import database from data.interfaces.verbs import pre_oci_model as model from endpoints.common import route_show_if, parse_repository_name diff --git a/endpoints/web.py b/endpoints/web.py index ccae5e9dd..dbee4fcb1 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -14,10 +14,11 @@ from app import (app, billing as stripe, build_logs, avatar, signer, log_archive get_app_url, instance_keys, user_analytics) from auth import scopes from auth.auth_context import get_authenticated_user +from auth.decorators import (has_basic_auth, require_session_login, process_oauth, + process_auth_or_cookie) from auth.permissions import (AdministerOrganizationPermission, ReadRepositoryPermission, SuperUserPermission, AdministerRepositoryPermission, ModifyRepositoryPermission, OrganizationMemberPermission) -from auth.process import require_session_login, process_oauth, has_basic_auth, process_auth_or_cookie from buildtrigger.basehandler import BuildTriggerHandler from buildtrigger.bitbuckethandler import BitbucketBuildTrigger from buildtrigger.customhandler import CustomBuildTrigger diff --git a/endpoints/webhooks.py b/endpoints/webhooks.py index 83c205fbf..b3372da36 100644 --- a/endpoints/webhooks.py +++ b/endpoints/webhooks.py @@ -4,8 +4,8 @@ from flask import request, make_response, Blueprint from app import billing as stripe from data import model +from auth.decorators import process_auth from auth.permissions import ModifyRepositoryPermission -from auth.process import process_auth from util.invoice import renderInvoiceToHtml from util.useremails import send_invoice_email, send_subscription_change, send_payment_failed from util.http import abort