-
Notifications
You must be signed in to change notification settings - Fork 89
CLOUDP-330236: Adds NewServiceAccountTransport #4075
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
CLOUDP-330236: Adds NewServiceAccountTransport #4075
Conversation
APIx Bot |
|
||
func NewServiceAccountTransport(clientID, clientSecret string, base http.RoundTripper) (http.RoundTripper, error) { | ||
cfg := clientcredentials.NewConfig(clientID, clientSecret) | ||
if config.OpsManagerURL() != "" { |
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.
what if is ""
?
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.
clientcredentials.NewConfig
already sets TokenURL
and RevokeURL
but points them to https://cloud.mongodb.com
.
So this logic is to ensure we point to the correct cloud environment if OpsManagerURL is pointing to dev or qa.
Proposed changes
Adds new transport for Service Accounts.
Unit testing:
Added two new unit tests for transport.go
Manual Testing:
I have tested this transport type by implementing the transport into the client creator logic (This implementation will be put for review as a part of CLOUDP-329787) and manually setting up SA credentials in the config. I've also ensured that the transport method continues to work even after the first token generated by this transport type expired to ensure refresh logic is working.
truncated config file:
Cmd calls using Service Accounts profile

Jira ticket: CLOUDP-330236
Checklist
make fmt
and formatted my codeFurther comments