# Path: il2fb/ds/airbridge/api/http/constants.py
# DEFAULT_AUTH_TOKEN_HEADER_NAME = "X-Airbridge-Token"
# 
# Path: il2fb/ds/airbridge/typing.py



import base64
import functools
import logging
import aiohttp_cors
from typing import Optional
from aiohttp import web
from il2fb.ds.airbridge.api.http.constants import DEFAULT_AUTH_TOKEN_HEADER_NAME
from il2fb.ds.airbridge.typing import StringOrPath
# coding: utf-8







LOG = logging.getLogger(__name__)


def setup_cors(app: web.Application, options: dict) -> None:
    defaults = {
        key: aiohttp_cors.ResourceOptions(**value)
        for key, value in options.items()
    }
    cors = aiohttp_cors.setup(app, defaults=defaults)

    for route in app.router.routes():
        cors.add(route)


class AuthorizationBackend:

    def __init__(
        self,
        token_storage_path: StringOrPath,
        token_header_name: Optional[str]=None,
    ):
        self._token_header_name = (

# Path: il2fb/ds/airbridge/api/http/constants.py
# DEFAULT_AUTH_TOKEN_HEADER_NAME = "X-Airbridge-Token"
# 
# Path: il2fb/ds/airbridge/typing.py



# Path: il2fb/ds/airbridge/api/http/security.py
import base64
import functools
import logging
import aiohttp_cors
from typing import Optional
from aiohttp import web
from il2fb.ds.airbridge.api.http.constants import DEFAULT_AUTH_TOKEN_HEADER_NAME
from il2fb.ds.airbridge.typing import StringOrPath

# coding: utf-8







LOG = logging.getLogger(__name__)


def setup_cors(app: web.Application, options: dict) -> None:
    defaults = {
        key: aiohttp_cors.ResourceOptions(**value)
        for key, value in options.items()
    }
    cors = aiohttp_cors.setup(app, defaults=defaults)

    for route in app.router.routes():
        cors.add(route)


class AuthorizationBackend:

    def __init__(
        self,
        token_storage_path: StringOrPath,
        token_header_name: Optional[str]=None,
    ):
        self._token_header_name = (

            token_header_name or DEFAULT_AUTH_TOKEN_HEADER_NAME