From 41eb3f398612a864f045d3e19c5df0ae397c8d80 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 8 Dec 2021 18:31:44 -0500 Subject: [Enterprise] API for getting the current session token --- python/enterprise.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'python/enterprise.py') diff --git a/python/enterprise.py b/python/enterprise.py index b94fd7ca..1d9743a1 100644 --- a/python/enterprise.py +++ b/python/enterprise.py @@ -99,6 +99,17 @@ def username() -> Optional[str]: return value +def token() -> Optional[str]: + """ + Get the token of the currently authenticated user to the Enterprise Server. + :return: Token, if authenticated. None, otherwise. + """ + value = core.BNGetEnterpriseServerToken() + if value == "": + return None + return value + + def server_name() -> Optional[str]: """ Get the display name of the currently connected server -- cgit v1.3.1