-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Installer Authentication to CLI #23
base: master
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis PR implements installer authentication in the CLI by refactoring the session management system to support different user types (regular user and installer) and introducing new credential handling mechanisms. The implementation replaces the simple password-based authentication with a more flexible system that supports both user passwords and installer credentials (master key + service code). Sequence diagram for CLI login processsequenceDiagram
actor User
participant CLI
participant ApiShell
participant SessionCache
participant ApiClient
User->>CLI: Provide credentials
CLI->>ApiShell: Initialize with credentials
ApiShell->>SessionCache: Read session_id
alt Session exists
SessionCache-->>ApiShell: Return session_id
ApiShell->>ApiClient: Use session_id
ApiClient-->>ApiShell: Authentication success
else No session
ApiShell->>ApiClient: Login with key and service_code
ApiClient-->>ApiShell: Return new session_id
ApiShell->>SessionCache: Write session_id
end
ApiShell-->>CLI: Ready for commands
Updated class diagram for SessionCache and ApiShellclassDiagram
class SessionCache {
-Path _cache_file
+__init__(host: str, user: str)
+read_session_id() Union[str, None]
+write_session_id(id: str)
+remove()
}
class ApiShell {
-ApiClient client
-SessionCache _session_cache
+__init__(client: ApiClient, user: str)
+prepare_client(key: Optional[str], service_code: Optional[str])
+print_exception()
+run(key: Optional[str], service_code: Optional[str])
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @stegm - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding explicit documentation of the credentials file format in the code (e.g. in the --credentials option help text or as a module docstring), including examples of both user and installer authentication formats.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
1d42c22
to
f652043
Compare
f652043
to
719abfb
Compare
credentials format:
User:
Installer:
see also #21
Summary by Sourcery
Add installer authentication to the CLI, allowing login with a master key and service code. Refactor session management to support user identification and improve cache handling. Deprecate --password-file in favor of --credentials and update related documentation. Implement tests for credential handling and invalid option scenarios.
New Features:
Enhancements:
Documentation:
Tests: