authentik/passbook/sources/oauth/apps.py

27 lines
776 B
Python
Raw Normal View History

2018-11-11 12:41:48 +00:00
"""passbook oauth_client config"""
2018-11-16 08:10:35 +00:00
from importlib import import_module
2018-11-11 12:41:48 +00:00
from django.apps import AppConfig
2019-10-07 15:33:48 +01:00
from django.conf import settings
2019-10-01 09:24:10 +01:00
from structlog import get_logger
2018-11-16 08:10:35 +00:00
LOGGER = get_logger()
2018-11-11 12:41:48 +00:00
2019-12-31 11:51:16 +00:00
2019-10-07 15:33:48 +01:00
class PassbookSourceOAuthConfig(AppConfig):
"""passbook source.oauth config"""
2018-11-11 12:41:48 +00:00
2019-12-31 11:51:16 +00:00
name = "passbook.sources.oauth"
label = "passbook_sources_oauth"
verbose_name = "passbook Sources.OAuth"
mountpoint = "source/oauth/"
2018-11-11 12:41:48 +00:00
def ready(self):
"""Load source_types from config file"""
2019-10-07 15:33:48 +01:00
for source_type in settings.PASSBOOK_SOURCES_OAUTH_TYPES:
2018-11-11 12:41:48 +00:00
try:
import_module(source_type)
LOGGER.debug("Loaded OAuth Source Type", type=source_type)
2018-11-11 12:41:48 +00:00
except ImportError as exc:
LOGGER.debug(exc)