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: Add scopes option to client #1082

Merged
merged 7 commits into from
Dec 18, 2024

Conversation

alldoami
Copy link
Contributor

@alldoami alldoami commented Dec 12, 2024

No new added parameters to the function, the user will need to pass in something like this:

func ScopeOptions(c *Client) {
c.OIDCConfig.Scopes = []string{"blah", "blah"}
}

to add new scopes to the client if they don't want the default scopes.

@alldoami alldoami requested a review from a team as a code owner December 12, 2024 22:33
@alldoami alldoami requested a review from jakeyheath December 16, 2024 22:24
@alldoami alldoami requested a review from jakeyheath December 16, 2024 22:52
@@ -36,7 +36,7 @@ type Config struct {
}

// NewClient returns a new client
func NewClient(ctx context.Context, config *Config, clientOptions ...Option) (*Client, error) {
func NewClient(ctx context.Context, config *Config, scopes []string, clientOptions ...Option) (*Client, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this scopes argument and use the clientOptions instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm trying to understand how this option works. Could you explain how we'd use it?

Copy link
Contributor

Choose a reason for hiding this comment

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

kind of like this comment: #1082 (comment).

You'd have an Option function that updates the scopes, rather than passing them in.

@alldoami alldoami requested a review from jakeyheath December 17, 2024 18:20
Copy link
Contributor

@jakeyheath jakeyheath left a comment

Choose a reason for hiding this comment

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

Looks good!

As an additional item, please at a SetOauthConfigScope function that does what you say in the comments. Place is under the here:

var SetOauth2AuthStyle = func(authStyle oauth2.AuthStyle) Option {
under the other option functions. I feel like that is common of enough of an option that others will want to use it.

@alldoami alldoami requested a review from jakeyheath December 18, 2024 00:51
@alldoami alldoami merged commit 4125bab into main Dec 18, 2024
9 checks passed
@alldoami alldoami deleted the CDI-3660-add-scopes-option-in-get-token branch December 18, 2024 17:55
@czi-github-helper czi-github-helper bot mentioned this pull request Dec 18, 2024
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