-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathauth_command.py
More file actions
29 lines (21 loc) · 926 Bytes
/
auth_command.py
File metadata and controls
29 lines (21 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import typer
from cycode.cli.apps.auth.auth_manager import AuthManager
from cycode.cli.exceptions.handle_auth_errors import handle_auth_exception
from cycode.cli.logger import logger
from cycode.cli.models import CliResult
def auth_command(ctx: typer.Context) -> None:
""":key: [bold cyan]Authenticate your machine with Cycode.[/]
This command handles authentication with Cycode's security platform.
Example usage:
* `cycode auth`: Start interactive authentication
* `cycode auth --help`: View authentication options
"""
printer = ctx.obj.get('console_printer')
try:
logger.debug('Starting authentication process')
auth_manager = AuthManager()
auth_manager.authenticate()
result = CliResult(success=True, message='Successfully logged into cycode')
printer.print_result(result)
except Exception as err:
handle_auth_exception(ctx, err)