mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Register a before_request event for all blueprints, that defines the authentication requirement.
There are three authentication methods: - requires_no_auth - public endpoint that does not require an Authorisation header - requires_auth - public endpoints that need an API key in the Authorisation header - requires_admin_auth - private endpoint that requires an Authorisation header which contains the API key for the defined as the client admin user
This commit is contained in:
@@ -41,8 +41,7 @@ from app.dao import notifications_dao
|
||||
from app.dao.provider_statistics_dao import get_fragment_count
|
||||
from app.dao.users_dao import get_user_by_id
|
||||
from app.errors import (
|
||||
InvalidRequest,
|
||||
register_errors)
|
||||
InvalidRequest, register_errors)
|
||||
from app.service import statistics
|
||||
from app.service.utils import get_whitelist_objects
|
||||
from app.schemas import (
|
||||
@@ -57,11 +56,8 @@ from app.schemas import (
|
||||
from app.utils import pagination_links, get_london_midnight_in_utc
|
||||
from flask import Blueprint
|
||||
|
||||
from app.authentication.auth import requires_admin_auth
|
||||
|
||||
service_blueprint = Blueprint('service', __name__)
|
||||
|
||||
service_blueprint.before_request(requires_admin_auth)
|
||||
register_errors(service_blueprint)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user