(client, auth_mount, bless_cache)
Authenticates a user in HashiCorp Vault using Okta
    :param bless_cache: Bless Cache to cache auth token
    :param auth_mount: Authentication mount point on Vault
    :param client: HashiCorp Vault client
    :return: Updated HashiCorp Vault client, and linux username
Authenticates a user in HashiCorp Vault using Okta
    :param bless_cache: Bless Cache to cache auth token
    :param auth_mount: Authentication mount point on Vault
    :param client: HashiCorp Vault client
    :return: Updated HashiCorp Vault client, and linux username
Authenticates a user in HashiCorp Vault using Okta : param bless_cache : Bless Cache to cache auth token : param auth_mount : Authentication mount point on Vault : param client : HashiCorp Vault client : return : Updated HashiCorp Vault client and linux username
def auth_okta(client, auth_mount, bless_cache):
    """
    Authenticates a user in HashiCorp Vault using Okta
    :param bless_cache: Bless Cache to cache auth token
    :param auth_mount: Authentication mount point on Vault
    :param client: HashiCorp Vault client
    :return: Updated HashiCorp Vault client, and linux username
    """

    vault_auth_token = get_cached_auth_token(bless_cache)
    if vault_auth_token is not None:
        client.token = vault_auth_token
        username = get_linux_username(bless_cache.get('vault_creds')['username'])
        return client, get_linux_username(username)
    else:
        username, password = get_credentials()
        auth_params = {
            'password': password
        }
        current_time = datetime.datetime.utcnow()
        auth_url = '/v1/auth/{0}/login/{1}'.format(auth_mount, username)
        response = client.auth(auth_url, json=auth_params)

        token = response['auth']['client_token']
        expiration = current_time + datetime.timedelta(seconds=response['auth']['lease_duration'])
        username = get_linux_username(response['auth']['metadata']['username'])
        vault_credentials_cache = {
            "token": token,
            "expiration": expiration.strftime('%Y%m%dT%H%M%SZ'),
            "username": username
        }
        bless_cache.set('vault_creds', vault_credentials_cache)
        bless_cache.save()
        return client, get_linux_username(username)
def auth_okta ( client , auth_mount , bless_cache ) : vault_auth_token = get_cached_auth_token ( bless_cache ) if vault_auth_token is not None : client . token = vault_auth_token username = get_linux_username ( bless_cache . get ( 'vault_creds' ) [ 'username' ] ) return client , get_linux_username ( username ) else : username , password = get_credentials ( ) auth_params = { 'password' : password } current_time = datetime . datetime . utcnow ( ) auth_url = '/v1/auth/{0}/login/{1}' . format ( auth_mount , username ) response = client . auth ( auth_url , json = auth_params ) token = response [ 'auth' ] [ 'client_token' ] expiration = current_time + datetime . timedelta ( seconds = response [ 'auth' ] [ 'lease_duration' ] ) username = get_linux_username ( response [ 'auth' ] [ 'metadata' ] [ 'username' ] ) vault_credentials_cache = { "token" : token , "expiration" : expiration . strftime ( '%Y%m%dT%H%M%SZ' ) , "username" : username } bless_cache . set ( 'vault_creds' , vault_credentials_cache ) bless_cache . save ( ) return client , get_linux_username ( username )