-
Notifications
You must be signed in to change notification settings - Fork 104
feat: add api key support via client settings #1880
Conversation
86fe14a to
4119326
Compare
blakeli0
left a comment
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 on the surface, do you mind providing more info on this api key support? Is there a design doc? In what scenario we would want customers to set it? Is it going to be use for anything else other than setting a new header?
Here is the public doc: https://cloud.google.com/docs/authentication/api-keys |
Thanks, can you please add these info to the description of the PR and maybe explain the new auth flow if API key is set? Also please add some java doc to explain what this attribute is and when/how developers should use it? Like this |
| stubSettings.setQuotaProjectId(quotaProjectId); | ||
| return self(); | ||
| } | ||
|
|
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.
Please add Javadoc here.
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.
Can we use checkstyle to automatically check for javadoc on public methods?
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.
Not sure how flexible the checkstyle plugin is, as we would need to exclude a lot of classes marked with InternalApi, but we can give it a try.
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.
added javadoc
|
Kudos, SonarCloud Quality Gate passed! |
Done. |
TimurSadykov
left a comment
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.
auth bits looks good
| } | ||
|
|
||
| public final String getApiKey() { | ||
| return stubSettings.getApiKey(); |
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.
exclude empty values and return null, to avoid extra checks everywhere?
|
@arithmetic1728 gax-java has been moved to gapic-generator-java/gax-java. Blake notified me that this PR 1880 is important one worth moving. Would you move this pull request? Here is the steps: |








This PR supports API key via client settings. When an API key is provided via client settings, its value will be passed to API call request via
x-goog-api-keyheader and other types of credential is no longer needed. API key is useful for accessing public data anonymously, for instance google maps APIs, see https://cloud.google.com/docs/authentication/api-keysThis feature has been tested with language client, see arithmetic1728/java-language#1