Skip to content
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

feat(authentication): Parse auth token on root command #782

Merged
merged 5 commits into from
May 16, 2024

Conversation

javirln
Copy link
Member

@javirln javirln commented May 16, 2024

Parse the stored authentication token to know what kind of user is using the CLI.

This is a best effort approach.

Refs: #780

@javirln javirln requested review from migmartri and jiparis May 16, 2024 09:56
app/cli/cmd/root.go Outdated Show resolved Hide resolved
app/cli/cmd/root.go Outdated Show resolved Hide resolved
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
app/cli/cmd/root.go Outdated Show resolved Hide resolved
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln merged commit a1d9f61 into chainloop-dev:main May 16, 2024
13 checks passed

switch aud[0].(string) {
case apiTokenAudience:
return &ParsedToken{Type: "api-token"}, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, shouldn't we add the identifier of the token? That way we can know how much for example a single token is being used in an org?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I mean the identifier of both the API_TOKEN and the RobotAccount

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see it as the ID on the ParsedToken or a new field TokenID?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm, I was thinking that maybe using the current ID in the ParsedToken? Why do you think we should do it as TokenID?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No no, to have different fields to filter by on the UI but we can merge them into ID since we have the type of token to know if it's a user.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh, I see, no idea tbh. You probably know more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants