-
Notifications
You must be signed in to change notification settings - Fork 113
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
Modularized api token management in GRAPPA drivers #1574
Conversation
Let's try to remove any references to token generation in the interface methods. We can have a struct |
@ishank011 can you explain a bit about the "instantiated by the rest packages" part? Also, are you implying that the interface methods in user and group rest packages should call |
Ah okay, so I should create a new struct in the And the fields for the struct should be the configurations, necessary for the token generation. |
Signed-off-by: Jimil Desai <[email protected]>
Signed-off-by: Jimil Desai <[email protected]>
Signed-off-by: Jimil Desai <[email protected]>
Signed-off-by: Jimil Desai <[email protected]>
Signed-off-by: Jimil Desai <[email protected]>
Signed-off-by: Jimil Desai <[email protected]>
Signed-off-by: Jimil Desai <[email protected]>
@ishank011 Can you take a look? |
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.
LGTM!
func (a *APITokenManager) getAPIToken(ctx context.Context) (string, time.Time, error) { | ||
|
||
params := url.Values{ | ||
"grant_types": {"client_credentials"}, |
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.
@jimil749 grant_type :D
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.
Ah! My bad! I'll send a new pr with the change
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.
No worries, I fixed it in my PR
Fixes #1562
This PR moves duplicated api token management methods:
renewAPIToken
getAPIToken
SendAPIRequest
into a seperate
utils
package to prevent duplication. The above methods are used byuser/rest
andgroup/rest
packages.PS: I am not 100% sure of the approach used here, so it'd be great if someone could suggest a better way to implement this. I'd be happy to work on the changes.
Signed-off-by: Jimil Desai [email protected]