# Path: lib/credentials_adapters.py
# class CredentialsFactory(AbstractCredentialsFactory):
#     def __init__(self):
#         pass
# 
#     @staticmethod
#     def instantiate(credential_type="user"):
#         return {"user": St2UserCredentials, "token": St2UserToken, "apikey": St2ApiKey}.get(
#             credential_type, St2UserCredentials
#         )
# 
# Path: lib/authentication_handler.py
# class AuthHandlerFactory(AbstractAuthHandlerFactory):
#     def __init__(self):
#         pass
# 
#     @staticmethod
#     def instantiate(handler_type):
#         handler_types = {
#             "serverside": ServerSideAuthHandler,
#             "clientside": ClientSideAuthHandler,
#             "standalone": StandaloneAuthHandler,
#         }
#         if handler_type not in handler_types:
#             LOG.warning("Default to Standalone authentication, {} unspported.".format(handler_type))
#         return handler_types.get(handler_type, StandaloneAuthHandler)


import logging
from lib.credentials_adapters import CredentialsFactory
from lib.authentication_handler import AuthHandlerFactory
                self, rbac_auth[rbac_type]
            )
        if self.auth_handler is None:
            LOG.warning(
                "Failed to configure RBAC authentication handler.  Check the configuration."
            )
        return True

    def _configure_prefixes(self, bot_conf):
        self.bot_prefix = bot_conf.BOT_PREFIX
        self.plugin_prefix = bot_conf.STACKSTORM.get("plugin_prefix", "st2")
        self.full_prefix = "{}{} ".format(bot_conf.BOT_PREFIX, self.plugin_prefix)

    def _configure_stackstorm(self, bot_conf):
        self.api_url = bot_conf.STACKSTORM.get("api_url", "http://localhost:9101/v1")
        self.auth_url = bot_conf.STACKSTORM.get("auth_url", "http://localhost:9100/v1")
        self.stream_url = bot_conf.STACKSTORM.get("stream_url", "http://localhost:9102/v1")

    def _configure_credentials(self, bot_conf):
        self.api_auth = bot_conf.STACKSTORM.get("api_auth", {})
        self.bot_creds = None
        for cred_type in ["apikey", "user", "token"]:
            c = self.api_auth.get(cred_type)
            if c:
                if cred_type == "user":
                    self.bot_creds = CredentialsFactory.instantiate(cred_type)(
                        c.get("name"), c.get("password")
                    )
                    break
                else:

# Path: lib/credentials_adapters.py
# class CredentialsFactory(AbstractCredentialsFactory):
#     def __init__(self):
#         pass
# 
#     @staticmethod
#     def instantiate(credential_type="user"):
#         return {"user": St2UserCredentials, "token": St2UserToken, "apikey": St2ApiKey}.get(
#             credential_type, St2UserCredentials
#         )
# 
# Path: lib/authentication_handler.py
# class AuthHandlerFactory(AbstractAuthHandlerFactory):
#     def __init__(self):
#         pass
# 
#     @staticmethod
#     def instantiate(handler_type):
#         handler_types = {
#             "serverside": ServerSideAuthHandler,
#             "clientside": ClientSideAuthHandler,
#             "standalone": StandaloneAuthHandler,
#         }
#         if handler_type not in handler_types:
#             LOG.warning("Default to Standalone authentication, {} unspported.".format(handler_type))
#         return handler_types.get(handler_type, StandaloneAuthHandler)


# Path: lib/config.py
import logging
from lib.credentials_adapters import CredentialsFactory
from lib.authentication_handler import AuthHandlerFactory

                self, rbac_auth[rbac_type]
            )
        if self.auth_handler is None:
            LOG.warning(
                "Failed to configure RBAC authentication handler.  Check the configuration."
            )
        return True

    def _configure_prefixes(self, bot_conf):
        self.bot_prefix = bot_conf.BOT_PREFIX
        self.plugin_prefix = bot_conf.STACKSTORM.get("plugin_prefix", "st2")
        self.full_prefix = "{}{} ".format(bot_conf.BOT_PREFIX, self.plugin_prefix)

    def _configure_stackstorm(self, bot_conf):
        self.api_url = bot_conf.STACKSTORM.get("api_url", "http://localhost:9101/v1")
        self.auth_url = bot_conf.STACKSTORM.get("auth_url", "http://localhost:9100/v1")
        self.stream_url = bot_conf.STACKSTORM.get("stream_url", "http://localhost:9102/v1")

    def _configure_credentials(self, bot_conf):
        self.api_auth = bot_conf.STACKSTORM.get("api_auth", {})
        self.bot_creds = None
        for cred_type in ["apikey", "user", "token"]:
            c = self.api_auth.get(cred_type)
            if c:
                if cred_type == "user":
                    self.bot_creds = CredentialsFactory.instantiate(cred_type)(
                        c.get("name"), c.get("password")
                    )
                    break
                else:

                    self.bot_creds = CredentialsFactory.instantiate(cred_type)(c)