From 7426e551deac1278e08dbe1fa24707f3dd55682e Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Wed, 6 Sep 2023 08:14:34 -0400 Subject: [PATCH] Restore legacy method handlers. Resolves #1043. --- src/falconpy/_auth_object/_uber_interface.py | 11 ++++++++++- src/falconpy/oauth2.py | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/falconpy/_auth_object/_uber_interface.py b/src/falconpy/_auth_object/_uber_interface.py index 9e78ded88..7ffcbd520 100644 --- a/src/falconpy/_auth_object/_uber_interface.py +++ b/src/falconpy/_auth_object/_uber_interface.py @@ -142,7 +142,7 @@ def login(self) -> bool: """Generate an authorization token.""" super().login() - return self.authenticated + return self.token_valid def logout(self) -> bool: """Revoke the current authorization token.""" @@ -150,6 +150,15 @@ def logout(self) -> bool: return bool(result["status_code"] == 200) + # Legacy property getters maintained for backwards functionality. + def authenticated(self) -> bool: + """Return the current authentication status.""" + return self.token_valid + + def token_expired(self) -> bool: + """Return the current token expiration status.""" + return self.token_stale + # _ ____ ____ ____ ____ _ _ _ _ ____ _ _ ___ _ ____ ____ ____ # | |___ | __ |__| | \_/ |__| |__| |\ | | \ | |___ |__/ [__ # |___ |___ |__] | | |___ | | | | | | \| |__/ |___ |___ | \ ___] diff --git a/src/falconpy/oauth2.py b/src/falconpy/oauth2.py index b733ce415..1fe717b99 100644 --- a/src/falconpy/oauth2.py +++ b/src/falconpy/oauth2.py @@ -223,6 +223,15 @@ def token(self, alter_state: bool = False) -> Dict[str, Union[int, dict]]: """ return self._login_handler(not alter_state) + # Legacy method handlers that recreates pre-1.3 functionality. + def authenticated(self) -> bool: + """Return the current authentication status.""" + return self.token_valid + + def token_expired(self) -> bool: + """Return the current token expiration status.""" + return self.token_stale + # These method names align to the operation IDs in the API but # do not conform to snake_case / PEP8 and are defined here for # backwards compatibility / ease of use purposes