-
Notifications
You must be signed in to change notification settings - Fork 3
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!: customizable client scopes in oidc_impl package #1052
Conversation
…go-misc into aku/set-scopes-if-needed
…-scopes-if-needed
@@ -184,15 +180,31 @@ func (c *Client) ValidateState(ourState []byte, otherState []byte) error { | |||
} | |||
return nil | |||
} | |||
func format_scopes(ctx context.Context, scopes []string) string { |
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.
For consistency, let's user camelcase, and rename to formatScopes()
.
oidc.ScopeOpenID, | ||
oidc.ScopeOfflineAccess, | ||
"email", | ||
"groups", |
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.
Will we always have to add all these scopes manually now? If so, would it be worth adding a function AddDefaultScopes
that adds all of these?
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.
@hspitzley-czi That was my initial idea, but I'd understand if that's not ideal!
Do you mean adding a function like this to oidc_cli/oidc_impl/client/config_options.go?
var AddDefaultScopes = func(scope string) Option {
return func(c *Client) {
c.oauthConfig.Scopes = []string{"openid", "groups", "email", "offline_access"}
}
}
Or like, adding all the default scopes if none are provided?
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.
Yeah like the AddDefaultScopes
you defined here! Adding default scopes if none are provided would be nice too if possible, that way it's backwards compatible
this has the potential to break some dependencies using an unpinned version of this package since it starts with no scopes, but there's a method to add the scopes through its helper function,
AddScope