Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
483 changes: 446 additions & 37 deletions examples/sdk_examples/action_report/action_report.py

Large diffs are not rendered by default.

477 changes: 444 additions & 33 deletions examples/sdk_examples/aging_report/aging_report.py

Large diffs are not rendered by default.

493 changes: 440 additions & 53 deletions examples/sdk_examples/audit_alert/list_alerts.py

Large diffs are not rendered by default.

492 changes: 440 additions & 52 deletions examples/sdk_examples/audit_alert/view_alert.py

Large diffs are not rendered by default.

494 changes: 441 additions & 53 deletions examples/sdk_examples/audit_report/audit_log.py

Large diffs are not rendered by default.

494 changes: 441 additions & 53 deletions examples/sdk_examples/audit_report/audit_summary.py

Large diffs are not rendered by default.

19 changes: 16 additions & 3 deletions examples/sdk_examples/auth/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@
pyperclip = None

logger = utils.get_logger()
logger.setLevel(logging.WARNING)
logger.setLevel(logging.INFO)
if not logger.handlers:
_handler = logging.StreamHandler()
_handler.setLevel(logging.INFO)
_handler.setFormatter(
logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s")
)
logger.addHandler(_handler)


class FidoCliInteraction(fido2.client.UserInteraction, IKeeperUserInteraction):
Expand Down Expand Up @@ -71,6 +78,11 @@ def __init__(self) -> None:
def endpoint(self) -> Optional[endpoint.KeeperEndpoint]:
return self._endpoint

@property
def logged_in_with_persistent(self) -> bool:
"""True if login succeeded by resuming an existing persistent session (no step loop)."""
return self._logged_in_with_persistent

def run(self) -> Optional[keeper_auth.KeeperAuth]:
"""
Run the login flow.
Expand Down Expand Up @@ -139,6 +151,7 @@ def _handle_device_approval(
"ask admin to approve this device and then press return/enter to resume"
)
input()
step.resume()

def _handle_password(self, step: login_auth.LoginStepPassword) -> None:
password = getpass.getpass("Enter password: ")
Expand Down Expand Up @@ -430,7 +443,7 @@ def login():
"""
flow = LoginFlow()
keeper_auth_context = flow.run()
if keeper_auth_context:
if keeper_auth_context and not flow.logged_in_with_persistent:
enable_persistent_login(keeper_auth_context)
keeper_endpoint = flow.endpoint if keeper_auth_context else None
return keeper_auth_context, keeper_endpoint
Expand All @@ -439,7 +452,7 @@ def login():
def display_login_info(keeper_auth_context: keeper_auth.KeeperAuth, keeper_endpoint: endpoint.KeeperEndpoint):
"""
Display login success information.

Args:
keeper_auth_context: The authenticated Keeper context.
keeper_endpoint: The Keeper endpoint with server information.
Expand Down
Loading