コード例 #1
0
def test_invalid_get_keyvault_secret(monkeypatch):
    monkeypatch.setattr(
        'processor.helper.httpapi.restapi_azure.http_get_request',
        mock_invalid_http_get_request)
    from processor.helper.httpapi.restapi_azure import get_keyvault_secret
    val = get_keyvault_secret('abcdvault', 'abcdsecret', 'vaulttoken')
    assert val == {'access_token': None}
コード例 #2
0
def get_azure_vault_data(secret_key=None):
    """Fetches the bearer token for Azure Vault API calls"""
    val = None
    vaulttoken = _get_vault_token()
    logger.debug('Vault Token: %s', vaulttoken)
    if vaulttoken and secret_key:
        keyvault = config_value('VAULT', 'keyvault')
        # secret_key = config_value('VAULT', 'secret_key')
        logger.info('Keyvault: %s, key:%s', keyvault, secret_key)
        secret_data = get_keyvault_secret(keyvault, secret_key, vaulttoken)
        if secret_data and 'value' in secret_data:
            val = secret_data['value']
    return val