Skip to content

Commit

Permalink
Restore legacy method handlers. Resolves #1043.
Browse files Browse the repository at this point in the history
  • Loading branch information
jshcodes committed Sep 13, 2023
1 parent 9e18e9d commit c78b595
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/falconpy/_auth_object/_uber_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,23 @@ 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."""
result = super().logout()

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

# _ ____ ____ ____ ____ _ _ _ _ ____ _ _ ___ _ ____ ____ ____
# | |___ | __ |__| | \_/ |__| |__| |\ | | \ | |___ |__/ [__
# |___ |___ |__] | | |___ | | | | | | \| |__/ |___ |___ | \ ___]
Expand Down
9 changes: 9 additions & 0 deletions src/falconpy/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c78b595

Please sign in to comment.