-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/user login #43
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
Open
ewassef
wants to merge
5
commits into
main
Choose a base branch
from
feature/user-login
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d11cd60
Add OAuth2 device code authentication to CLI
ewassef 7ac2f4f
Add grant_type to device flow request
ewassef 230acd3
Add cluster label support and update vega.conf
ewassef 5f17c71
Merge branch 'main' into feature/user-login
ewassef fc43ece
Update command option handling for System.CommandLine 2.x
ewassef File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(git add:*)", | ||
| "Bash(git commit -m \"$\\(cat <<''EOF''\nUpdate System.CommandLine to 2.0.2 stable release\n\nThe System.CommandLine package was upgraded from the beta version to the\nstable 2.0.2 release, which introduced breaking API changes that required\nupdates across all CLI command files.\n\nAPI changes addressed:\n- AddCommand\\(\\) -> Subcommands.Add\\(\\) for adding subcommands\n- AddOption\\(\\) -> Options.Add\\(\\) for adding options\n- SetHandler\\(\\) extension -> SetAction\\(\\) method for command handlers\n- Option constructor signature changed: description is now set via\n Description property instead of constructor parameter\n- InvokeAsync\\(\\) on Command -> Parse\\(args\\).InvokeAsync\\(\\) in Program.cs\n\nFiles modified:\n- All command files under cli/src/Vdk/Commands/\n- cli/src/Vdk/Program.cs\n\nAlso normalizes line endings to LF per .gitattributes.\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")" | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using System.CommandLine; | ||
| using Vdk.Services; | ||
|
|
||
| namespace Vdk.Commands; | ||
|
|
||
| public class LoginCommand : Command | ||
| { | ||
| private readonly IAuthService _auth; | ||
|
|
||
| public LoginCommand(IAuthService auth) : base("login", "Authenticate with the Vega identity provider using device code flow") | ||
| { | ||
| _auth = auth; | ||
| var profile = new Option<string?>("--profile") { Description = "Optional profile name for this login (supports multiple accounts)" }; | ||
| Options.Add(profile); | ||
| SetAction(async parseResult => | ||
| { | ||
| var p = parseResult.GetValue(profile); | ||
| if (!string.IsNullOrWhiteSpace(p)) | ||
| { | ||
| _auth.SetCurrentProfile(p!); | ||
| } | ||
| await _auth.LoginAsync(p); | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using System.CommandLine; | ||
| using Vdk.Services; | ||
|
|
||
| namespace Vdk.Commands; | ||
|
|
||
| public class LogoutCommand : Command | ||
| { | ||
| private readonly IAuthService _auth; | ||
|
|
||
| public LogoutCommand(IAuthService auth) : base("logout", "Remove local credentials for the current or specified profile") | ||
| { | ||
| _auth = auth; | ||
| var profile = new Option<string?>("--profile") { Description = "Optional profile name to logout (defaults to current)" }; | ||
| Options.Add(profile); | ||
| SetAction(async parseResult => | ||
| { | ||
| var p = parseResult.GetValue(profile); | ||
| if (!string.IsNullOrWhiteSpace(p)) | ||
| { | ||
| _auth.SetCurrentProfile(p!); | ||
| } | ||
| await _auth.LogoutAsync(p); | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| namespace Vdk.Models; | ||
|
|
||
| public class AuthTokens | ||
| { | ||
| public string AccessToken { get; set; } = string.Empty; | ||
| public string RefreshToken { get; set; } = string.Empty; | ||
| public DateTimeOffset ExpiresAt { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The empty catch block should specify the expected exception type (e.g.,
catch (HttpOperationException)orcatch (KubernetesException)) to avoid catching unexpected exceptions that should be handled differently.