Move auth decorators into a decorators module

The non-decorators will be broken out in the followup change
This commit is contained in:
Joseph Schorr 2017-03-16 16:50:09 -04:00
parent abf179eb09
commit 1bd4422da9
14 changed files with 14 additions and 12 deletions

View file

@ -19,7 +19,7 @@ from auth.permissions import (ReadRepositoryPermission, ModifyRepositoryPermissi
UserAdminPermission) UserAdminPermission)
from auth import scopes from auth import scopes
from auth.auth_context import get_authenticated_user, get_validated_oauth_token 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.csrf import csrf_protect
from endpoints.exception import (ApiException, Unauthorized, InvalidRequest, InvalidResponse, from endpoints.exception import (ApiException, Unauthorized, InvalidRequest, InvalidResponse,
FreshLoginRequired, NotFound) FreshLoginRequired, NotFound)

View file

@ -4,7 +4,7 @@ from flask import request, redirect, url_for, Blueprint
from flask_login import current_user from flask_login import current_user
from app import app 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.basehandler import BuildTriggerHandler
from buildtrigger.bitbuckethandler import BitbucketBuildTrigger from buildtrigger.bitbuckethandler import BitbucketBuildTrigger
from data import model from data import model

View file

@ -6,8 +6,8 @@ from flask_login import current_user
import features import features
from app import app, github_trigger from app import app, github_trigger
from auth.decorators import require_session_login
from auth.permissions import AdministerRepositoryPermission from auth.permissions import AdministerRepositoryPermission
from auth.process import require_session_login
from data import model from data import model
from endpoints.common import route_show_if, parse_repository_name from endpoints.common import route_show_if, parse_repository_name
from util.http import abort from util.http import abort

View file

@ -6,8 +6,8 @@ from flask_login import current_user
import features import features
from app import app, gitlab_trigger from app import app, gitlab_trigger
from auth.decorators import require_session_login
from auth.permissions import AdministerRepositoryPermission from auth.permissions import AdministerRepositoryPermission
from auth.process import require_session_login
from data import model from data import model
from endpoints.common import route_show_if from endpoints.common import route_show_if
from util.http import abort from util.http import abort

View file

@ -8,7 +8,7 @@ import features
from app import app, analytics, get_app_url, oauth_login, authentication from app import app, analytics, get_app_url, oauth_login, authentication
from auth.auth_context import get_authenticated_user 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 data import model
from endpoints.common import common_login from endpoints.common import common_login
from endpoints.web import index from endpoints.web import index

View file

@ -5,7 +5,7 @@ from flask import request, Blueprint, abort, Response
from flask_login import current_user from flask_login import current_user
from app import userevents from app import userevents
from auth.process import require_session_login from auth.decorators import require_session_login
from data.userevent import CannotReadUserEventsException from data.userevent import CannotReadUserEventsException

View file

@ -9,10 +9,10 @@ from flask import request, make_response, jsonify, session
from data.interfaces.v1 import pre_oci_model as model from data.interfaces.v1 import pre_oci_model as model
from app import authentication, userevents, metric_queue from app import authentication, userevents, metric_queue
from auth.auth_context import get_authenticated_user, get_validated_token, get_validated_oauth_token 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, from auth.permissions import (ModifyRepositoryPermission, UserAdminPermission,
ReadRepositoryPermission, CreateRepositoryPermission, ReadRepositoryPermission, CreateRepositoryPermission,
repository_read_grant, repository_write_grant) repository_read_grant, repository_write_grant)
from auth.process import process_auth, generate_signed_token
from util.http import abort from util.http import abort
from util.names import REPOSITORY_NAME_REGEX from util.names import REPOSITORY_NAME_REGEX
from endpoints.common import parse_repository_name from endpoints.common import parse_repository_name

View file

@ -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 app import storage as store, app, metric_queue
from auth.auth_context import get_authenticated_user from auth.auth_context import get_authenticated_user
from auth.decorators import extract_namespace_repo_from_session, process_auth
from auth.permissions import (ReadRepositoryPermission, from auth.permissions import (ReadRepositoryPermission,
ModifyRepositoryPermission) ModifyRepositoryPermission)
from auth.process import process_auth, extract_namespace_repo_from_session
from auth.registry_jwt_auth import get_granted_username from auth.registry_jwt_auth import get_granted_username
from data import model, database from data import model, database
from data.interfaces.v1 import pre_oci_model as model from data.interfaces.v1 import pre_oci_model as model

View file

@ -5,9 +5,9 @@ from flask import abort, request, jsonify, make_response, session
from util.names import TAG_ERROR, TAG_REGEX from util.names import TAG_ERROR, TAG_REGEX
from auth.decorators import process_auth
from auth.permissions import (ReadRepositoryPermission, from auth.permissions import (ReadRepositoryPermission,
ModifyRepositoryPermission) ModifyRepositoryPermission)
from auth.process import process_auth
from data import model from data import model
from data.interfaces.v1 import pre_oci_model as model from data.interfaces.v1 import pre_oci_model as model
from endpoints.common import parse_repository_name from endpoints.common import parse_repository_name

View file

@ -6,6 +6,7 @@ from flask import request, jsonify, abort
from app import app, userevents, instance_keys from app import app, userevents, instance_keys
from auth.auth_context import get_authenticated_user, get_validated_token, get_validated_oauth_token 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, from auth.permissions import (ModifyRepositoryPermission, ReadRepositoryPermission,
CreateRepositoryPermission, AdministerRepositoryPermission) CreateRepositoryPermission, AdministerRepositoryPermission)
from auth.process import process_auth from auth.process import process_auth

View file

@ -7,8 +7,8 @@ import features
from app import app, signer, storage, metric_queue, license_validator from app import app, signer, storage, metric_queue, license_validator
from auth.auth_context import get_authenticated_user from auth.auth_context import get_authenticated_user
from auth.decorators import process_auth
from auth.permissions import ReadRepositoryPermission from auth.permissions import ReadRepositoryPermission
from auth.process import process_auth
from data import database from data import database
from data.interfaces.verbs import pre_oci_model as model from data.interfaces.verbs import pre_oci_model as model
from endpoints.common import route_show_if, parse_repository_name from endpoints.common import route_show_if, parse_repository_name

View file

@ -14,10 +14,11 @@ from app import (app, billing as stripe, build_logs, avatar, signer, log_archive
get_app_url, instance_keys, user_analytics) get_app_url, instance_keys, user_analytics)
from auth import scopes from auth import scopes
from auth.auth_context import get_authenticated_user 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, from auth.permissions import (AdministerOrganizationPermission, ReadRepositoryPermission,
SuperUserPermission, AdministerRepositoryPermission, SuperUserPermission, AdministerRepositoryPermission,
ModifyRepositoryPermission, OrganizationMemberPermission) 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.basehandler import BuildTriggerHandler
from buildtrigger.bitbuckethandler import BitbucketBuildTrigger from buildtrigger.bitbuckethandler import BitbucketBuildTrigger
from buildtrigger.customhandler import CustomBuildTrigger from buildtrigger.customhandler import CustomBuildTrigger

View file

@ -4,8 +4,8 @@ from flask import request, make_response, Blueprint
from app import billing as stripe from app import billing as stripe
from data import model from data import model
from auth.decorators import process_auth
from auth.permissions import ModifyRepositoryPermission from auth.permissions import ModifyRepositoryPermission
from auth.process import process_auth
from util.invoice import renderInvoiceToHtml from util.invoice import renderInvoiceToHtml
from util.useremails import send_invoice_email, send_subscription_change, send_payment_failed from util.useremails import send_invoice_email, send_subscription_change, send_payment_failed
from util.http import abort from util.http import abort