示例#1
0
def get_credentials_from_config(credential_config_name, cred_type=None):
    creds = conf.credentials[credential_config_name]
    domain = creds.get('domain', None)
    token = creds.get('token', None)
    return BaseProvider.Credential(principal=creds['username'],
                                   secret=creds['password'],
                                   cred_type=cred_type,
                                   domain=domain,
                                   token=token)
示例#2
0
def get_credentials(credential_dict, cred_type=None):
    """Processes a credential dictionary into a credential object.

    Args:
        credential_dict: A credential dictionary.
        cred_type: Type of credential (None, token, ssh, amqp, ...)

    Returns:
        A :py:class:`BaseProvider.Credential` instance.
    """
    domain = credential_dict.get('domain', None)
    token = credential_dict.get('token', None)
    service_account = credential_dict.get('service_account', None)
    if service_account:
        service_account = gce_service_account_formating(service_account)
    return BaseProvider.Credential(
        principal=credential_dict['username'],
        secret=credential_dict['password'],
        cred_type=cred_type,
        domain=domain,
        token=token,
        service_account=service_account)
示例#3
0
def get_credentials_from_config(credential_config_name):
    creds = conf.credentials[credential_config_name]
    return BaseProvider.Credential(principal=creds['username'],
                                   secret=creds['password'])