# Path: castellan/common/credentials/keystone_password.py
# class KeystonePassword(password.Password):
#     def __init__(self, password, auth_url=None, username=None, user_id=None,
#                  user_domain_id=None, user_domain_name=None, trust_id=None,
#                  domain_id=None, domain_name=None, project_id=None,
#                  project_name=None, project_domain_id=None,
#                  project_domain_name=None, reauthenticate=True):
#     def auth_url(self):
#     def user_id(self):
#     def user_domain_id(self):
#     def user_domain_name(self):
#     def trust_id(self):
#     def domain_id(self):
#     def domain_name(self):
#     def project_id(self):
#     def project_name(self):
#     def project_domain_id(self):
#     def project_domain_name(self):
#     def reauthenticate(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
# 
# Path: castellan/common/credentials/keystone_token.py
# class KeystoneToken(token.Token):
#     def __init__(self, token, auth_url=None, trust_id=None, domain_id=None,
#                  domain_name=None, project_id=None, project_name=None,
#                  project_domain_id=None, project_domain_name=None,
#                  reauthenticate=True):
#     def auth_url(self):
#     def trust_id(self):
#     def domain_id(self):
#     def domain_name(self):
#     def project_id(self):
#     def project_name(self):
#     def project_domain_id(self):
#     def project_domain_name(self):
#     def reauthenticate(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
# 
# Path: castellan/common/credentials/password.py
# @property
# def password(self):
#     """This method returns a password."""
#     return self._password
# 
# Path: castellan/common/credentials/token.py
# @property
# def token(self):
#     """This method returns a token."""
#     return self._token
# 
# Path: castellan/common/exception.py
# _FATAL_EXCEPTION_FORMAT_ERRORS = False
# class RedirectException(Exception):
# class CastellanException(Exception):
# class Forbidden(CastellanException):
# class KeyManagerError(CastellanException):
# class ManagedObjectNotFoundError(CastellanException):
# class InvalidManagedObjectDictError(CastellanException):
# class UnknownManagedObjectTypeError(CastellanException):
# class AuthTypeInvalidError(CastellanException):
# class InsufficientCredentialDataError(CastellanException):
#     def __init__(self, url):
#     def __init__(self, message_arg=None, *args, **kwargs):


from castellan.common.credentials import keystone_password
from castellan.common.credentials import keystone_token
from castellan.common.credentials import password
from castellan.common.credentials import token
from castellan.common import exception
from oslo_config import cfg
from oslo_log import log as logging
            if conf.key_manager.token:
                auth_token = conf.key_manager.token
            elif context:
                auth_token = context.auth_token
            else:
                raise exception.InsufficientCredentialDataError()

            return keystone_token.KeystoneToken(
                auth_token,
                auth_url=conf.key_manager.auth_url,
                trust_id=conf.key_manager.trust_id,
                domain_id=conf.key_manager.domain_id,
                domain_name=conf.key_manager.domain_name,
                project_id=conf.key_manager.project_id,
                project_name=conf.key_manager.project_name,
                project_domain_id=conf.key_manager.project_domain_id,
                project_domain_name=conf.key_manager.project_domain_name,
                reauthenticate=conf.key_manager.reauthenticate)

        else:
            LOG.error("Invalid auth_type specified.")
            raise exception.AuthTypeInvalidError(
                type=conf.key_manager.auth_type)

    # for compatibility between _TokenData and RequestContext
    if hasattr(context, 'tenant') and context.tenant:
        project_id = context.tenant
    elif hasattr(context, 'project_id') and context.project_id:
        project_id = context.project_id


# Path: castellan/common/credentials/keystone_password.py
# class KeystonePassword(password.Password):
#     def __init__(self, password, auth_url=None, username=None, user_id=None,
#                  user_domain_id=None, user_domain_name=None, trust_id=None,
#                  domain_id=None, domain_name=None, project_id=None,
#                  project_name=None, project_domain_id=None,
#                  project_domain_name=None, reauthenticate=True):
#     def auth_url(self):
#     def user_id(self):
#     def user_domain_id(self):
#     def user_domain_name(self):
#     def trust_id(self):
#     def domain_id(self):
#     def domain_name(self):
#     def project_id(self):
#     def project_name(self):
#     def project_domain_id(self):
#     def project_domain_name(self):
#     def reauthenticate(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
# 
# Path: castellan/common/credentials/keystone_token.py
# class KeystoneToken(token.Token):
#     def __init__(self, token, auth_url=None, trust_id=None, domain_id=None,
#                  domain_name=None, project_id=None, project_name=None,
#                  project_domain_id=None, project_domain_name=None,
#                  reauthenticate=True):
#     def auth_url(self):
#     def trust_id(self):
#     def domain_id(self):
#     def domain_name(self):
#     def project_id(self):
#     def project_name(self):
#     def project_domain_id(self):
#     def project_domain_name(self):
#     def reauthenticate(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
# 
# Path: castellan/common/credentials/password.py
# @property
# def password(self):
#     """This method returns a password."""
#     return self._password
# 
# Path: castellan/common/credentials/token.py
# @property
# def token(self):
#     """This method returns a token."""
#     return self._token
# 
# Path: castellan/common/exception.py
# _FATAL_EXCEPTION_FORMAT_ERRORS = False
# class RedirectException(Exception):
# class CastellanException(Exception):
# class Forbidden(CastellanException):
# class KeyManagerError(CastellanException):
# class ManagedObjectNotFoundError(CastellanException):
# class InvalidManagedObjectDictError(CastellanException):
# class UnknownManagedObjectTypeError(CastellanException):
# class AuthTypeInvalidError(CastellanException):
# class InsufficientCredentialDataError(CastellanException):
#     def __init__(self, url):
#     def __init__(self, message_arg=None, *args, **kwargs):


# Path: castellan/common/utils.py
from castellan.common.credentials import keystone_password
from castellan.common.credentials import keystone_token
from castellan.common.credentials import password
from castellan.common.credentials import token
from castellan.common import exception
from oslo_config import cfg
from oslo_log import log as logging

            if conf.key_manager.token:
                auth_token = conf.key_manager.token
            elif context:
                auth_token = context.auth_token
            else:
                raise exception.InsufficientCredentialDataError()

            return keystone_token.KeystoneToken(
                auth_token,
                auth_url=conf.key_manager.auth_url,
                trust_id=conf.key_manager.trust_id,
                domain_id=conf.key_manager.domain_id,
                domain_name=conf.key_manager.domain_name,
                project_id=conf.key_manager.project_id,
                project_name=conf.key_manager.project_name,
                project_domain_id=conf.key_manager.project_domain_id,
                project_domain_name=conf.key_manager.project_domain_name,
                reauthenticate=conf.key_manager.reauthenticate)

        else:
            LOG.error("Invalid auth_type specified.")
            raise exception.AuthTypeInvalidError(
                type=conf.key_manager.auth_type)

    # for compatibility between _TokenData and RequestContext
    if hasattr(context, 'tenant') and context.tenant:
        project_id = context.tenant
    elif hasattr(context, 'project_id') and context.project_id:
        project_id = context.project_id


    return keystone_token.KeystoneToken(