From 273b30abc8782767d4d94938dcda61b87e8efc83 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 8 Dec 2021 18:01:50 -0500 Subject: [Enterprise] "Remember me" option in api --- python/enterprise.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'python/enterprise.py') diff --git a/python/enterprise.py b/python/enterprise.py index 5ea57f0c..b94fd7ca 100644 --- a/python/enterprise.py +++ b/python/enterprise.py @@ -25,24 +25,26 @@ def is_connected() -> bool: return core.BNIsEnterpriseServerConnected() -def authenticate_with_credentials(username: str, password: str): +def authenticate_with_credentials(username: str, password: str, remember: bool = True): """ Authenticate to the Enterprise Server with username/password credentials. :param str username: Username to use. :param str password: Password to use. + :param bool remember: Remember token in keychain """ - if not core.BNAuthenticateEnterpriseServerWithCredentials(username, password): + if not core.BNAuthenticateEnterpriseServerWithCredentials(username, password, remember): raise RuntimeError(last_error()) -def authenticate_with_method(method: str): +def authenticate_with_method(method: str, remember: bool = True): """ Authenticate to the Enterprise Server with a non-password method. Note that many of these will open a URL for a browser-based login prompt, which may not be usable on headless installations. See :func:`authentication_methods` for a list of accepted methods. :param str method: Name of method to use. + :param bool remember: Remember token in keychain """ - if not core.BNAuthenticateEnterpriseServerWithMethod(method): + if not core.BNAuthenticateEnterpriseServerWithMethod(method, remember): raise RuntimeError(last_error()) -- cgit v1.3.1