Skip to content

Commit 1ddc994

Browse files
aeitzmanlsirac
andauthored
fix: fixed javadoc errors (#945)
* fix: fixed javadoc errors Update javadoc source version to 8 and modified configuration to ignore 'missing' javadoc comments since missing unnecessary @returns are getting flagged as an error. * Add missing @params and @return * linting fix * revert pom.xml changes * Addressing PR comments Co-authored-by: Leo <[email protected]>
1 parent abde3e5 commit 1ddc994

File tree

3 files changed

+127
-19
lines changed

3 files changed

+127
-19
lines changed

oauth2_http/java/com/google/auth/oauth2/CredentialAccessBoundary.java

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ private Builder() {}
120120
* Sets the list of {@link AccessBoundaryRule}'s.
121121
*
122122
* <p>This list must not exceed 10 rules.
123+
*
124+
* @param rule the collection of rules to be set, should not be null
125+
* @return this {@code Builder} object
123126
*/
124127
public Builder setRules(List<AccessBoundaryRule> rule) {
125128
accessBoundaryRules = new ArrayList<>(checkNotNull(rule));
@@ -211,6 +214,9 @@ private Builder() {}
211214
* access to.
212215
*
213216
* <p>For example: "//storage.googleapis.com/projects/_/buckets/example".
217+
*
218+
* @param availableResource the resource name to set
219+
* @return this {@code Builder} object
214220
*/
215221
public Builder setAvailableResource(String availableResource) {
216222
this.availableResource = availableResource;
@@ -222,6 +228,9 @@ public Builder setAvailableResource(String availableResource) {
222228
* roles prefixed by inRole.
223229
*
224230
* <p>For example: {"inRole:roles/storage.objectViewer"}.
231+
*
232+
* @param availablePermissions the collection of permissions to set, should not be null
233+
* @return this {@code Builder} object
225234
*/
226235
public Builder setAvailablePermissions(List<String> availablePermissions) {
227236
this.availablePermissions = new ArrayList<>(checkNotNull(availablePermissions));
@@ -233,6 +242,9 @@ public Builder setAvailablePermissions(List<String> availablePermissions) {
233242
* inRole.
234243
*
235244
* <p>For example: "inRole:roles/storage.objectViewer".
245+
*
246+
* @param availablePermission a permission to add, should not be null
247+
* @return this {@code Builder} object
236248
*/
237249
public Builder addAvailablePermission(String availablePermission) {
238250
if (availablePermissions == null) {
@@ -245,6 +257,9 @@ public Builder addAvailablePermission(String availablePermission) {
245257
/**
246258
* Sets the availability condition which is an IAM condition that defines constraints to apply
247259
* to the token expressed in CEL format.
260+
*
261+
* @param availabilityCondition the {@code AvailabilityCondition} to set
262+
* @return this {@code Builder} object
248263
*/
249264
public Builder setAvailabilityCondition(AvailabilityCondition availabilityCondition) {
250265
this.availabilityCondition = availabilityCondition;
@@ -318,19 +333,32 @@ private Builder() {}
318333
* <p>This expression specifies the Cloud Storage object where permissions are available.
319334
* See <a href='https://cloud.google.com/iam/docs/conditions-overview#cel'>for more
320335
* information.</a>
336+
*
337+
* @param expression the expression to set
338+
* @return this {@code Builder} object
321339
*/
322340
public Builder setExpression(String expression) {
323341
this.expression = expression;
324342
return this;
325343
}
326344

327-
/** Sets the optional title that identifies the purpose of the condition. */
345+
/**
346+
* Sets the optional title that identifies the purpose of the condition.
347+
*
348+
* @param title the title to set
349+
* @return this {@code Builder} object
350+
*/
328351
public Builder setTitle(String title) {
329352
this.title = title;
330353
return this;
331354
}
332355

333-
/** Sets the description that details the purpose of the condition. */
356+
/**
357+
* Sets the description that details the purpose of the condition.
358+
*
359+
* @param description the description to set
360+
* @return this {@code Builder} object
361+
*/
334362
public Builder setDescription(String description) {
335363
this.description = description;
336364
return this;

oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java

Lines changed: 93 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,25 @@ protected ExternalAccountCredentials(
159159
}
160160

161161
/**
162-
* See {@link ExternalAccountCredentials#ExternalAccountCredentials(HttpTransportFactory, String,
163-
* String, String, CredentialSource, String, String, String, String, String, Collection)}
162+
* Constructor with minimum identifying information and custom HTTP transport. Does not support
163+
* workforce credentials.
164164
*
165+
* @param transportFactory HTTP transport factory, creates the transport used to get access tokens
166+
* @param audience the Security Token Service audience, which is usually the fully specified
167+
* resource name of the workload/workforce pool provider
168+
* @param subjectTokenType the Security Token Service subject token type based on the OAuth 2.0
169+
* token exchange spec. Indicates the type of the security token in the credential file
170+
* @param tokenUrl the Security Token Service token exchange endpoint
171+
* @param tokenInfoUrl the endpoint used to retrieve account related information. Required for
172+
* gCloud session account identification.
173+
* @param credentialSource the external credential source
174+
* @param serviceAccountImpersonationUrl the URL for the service account impersonation request.
175+
* This URL is required for some APIs. If this URL is not available, the access token from the
176+
* Security Token Service is used directly. May be null.
177+
* @param quotaProjectId the project used for quota and billing purposes. May be null.
178+
* @param clientId client ID of the service account from the console. May be null.
179+
* @param clientSecret client secret of the service account from the console. May be null.
180+
* @param scopes the scopes to request during the authorization grant. May be null.
165181
* @param environmentProvider the environment provider. May be null. Defaults to {@link
166182
* SystemEnvironmentProvider}.
167183
*/
@@ -211,6 +227,8 @@ protected ExternalAccountCredentials(
211227
/**
212228
* Internal constructor with minimum identifying information and custom HTTP transport. See {@link
213229
* ExternalAccountCredentials.Builder}.
230+
*
231+
* @param builder the {@code Builder} object used to construct the credentials.
214232
*/
215233
protected ExternalAccountCredentials(ExternalAccountCredentials.Builder builder) {
216234
this.transportFactory =
@@ -494,6 +512,7 @@ protected AccessToken exchangeExternalCredentialForAccessToken(
494512
* source.
495513
*
496514
* @return the external subject token
515+
* @throws IOException if the subject token cannot be retrieved
497516
*/
498517
public abstract String retrieveSubjectToken() throws IOException;
499518

@@ -522,7 +541,7 @@ public String getServiceAccountImpersonationUrl() {
522541
return serviceAccountImpersonationUrl;
523542
}
524543

525-
/** The service account email to be impersonated, if available. */
544+
/** @return The service account email to be impersonated, if available */
526545
@Nullable
527546
public String getServiceAccountEmail() {
528547
if (serviceAccountImpersonationUrl == null || serviceAccountImpersonationUrl.isEmpty()) {
@@ -567,8 +586,8 @@ EnvironmentProvider getEnvironmentProvider() {
567586
}
568587

569588
/**
570-
* Returns whether the current configuration is for Workforce Pools (which enable 3p user
571-
* identities, rather than workloads).
589+
* @return whether the current configuration is for Workforce Pools (which enable 3p user
590+
* identities, rather than workloads)
572591
*/
573592
public boolean isWorkforcePoolConfiguration() {
574593
Pattern workforceAudiencePattern =
@@ -728,7 +747,12 @@ protected Builder(ExternalAccountCredentials credentials) {
728747
this.serviceAccountImpersonationOptions = credentials.serviceAccountImpersonationOptions;
729748
}
730749

731-
/** Sets the HTTP transport factory, creates the transport used to get access tokens. */
750+
/**
751+
* Sets the HTTP transport factory, creates the transport used to get access tokens.
752+
*
753+
* @param transportFactory the {@code HttpTransportFactory} to set
754+
* @return this {@code Builder} object
755+
*/
732756
public Builder setHttpTransportFactory(HttpTransportFactory transportFactory) {
733757
this.transportFactory = transportFactory;
734758
return this;
@@ -737,6 +761,9 @@ public Builder setHttpTransportFactory(HttpTransportFactory transportFactory) {
737761
/**
738762
* Sets the Security Token Service audience, which is usually the fully specified resource name
739763
* of the workload/workforce pool provider.
764+
*
765+
* @param audience the Security Token Service audience to set
766+
* @return this {@code Builder} object
740767
*/
741768
public Builder setAudience(String audience) {
742769
this.audience = audience;
@@ -746,19 +773,32 @@ public Builder setAudience(String audience) {
746773
/**
747774
* Sets the Security Token Service subject token type based on the OAuth 2.0 token exchange
748775
* spec. Indicates the type of the security token in the credential file.
776+
*
777+
* @param subjectTokenType the Security Token Service subject token type to set
778+
* @return this {@code Builder} object
749779
*/
750780
public Builder setSubjectTokenType(String subjectTokenType) {
751781
this.subjectTokenType = subjectTokenType;
752782
return this;
753783
}
754784

755-
/** Sets the Security Token Service token exchange endpoint. */
785+
/**
786+
* Sets the Security Token Service token exchange endpoint.
787+
*
788+
* @param tokenUrl the Security Token Service token exchange url to set
789+
* @return this {@code Builder} object
790+
*/
756791
public Builder setTokenUrl(String tokenUrl) {
757792
this.tokenUrl = tokenUrl;
758793
return this;
759794
}
760795

761-
/** Sets the external credential source. */
796+
/**
797+
* Sets the external credential source.
798+
*
799+
* @param credentialSource the {@code CredentialSource} to set
800+
* @return this {@code Builder} object
801+
*/
762802
public Builder setCredentialSource(CredentialSource credentialSource) {
763803
this.credentialSource = credentialSource;
764804
return this;
@@ -768,6 +808,9 @@ public Builder setCredentialSource(CredentialSource credentialSource) {
768808
* Sets the optional URL used for service account impersonation, which is required for some
769809
* APIs. If this URL is not available, the access token from the Security Token Service is used
770810
* directly.
811+
*
812+
* @param serviceAccountImpersonationUrl the service account impersonation url to set
813+
* @return this {@code Builder} object
771814
*/
772815
public Builder setServiceAccountImpersonationUrl(String serviceAccountImpersonationUrl) {
773816
this.serviceAccountImpersonationUrl = serviceAccountImpersonationUrl;
@@ -777,31 +820,54 @@ public Builder setServiceAccountImpersonationUrl(String serviceAccountImpersonat
777820
/**
778821
* Sets the optional endpoint used to retrieve account related information. Required for gCloud
779822
* session account identification.
823+
*
824+
* @param tokenInfoUrl the token info url to set
825+
* @return this {@code Builder} object
780826
*/
781827
public Builder setTokenInfoUrl(String tokenInfoUrl) {
782828
this.tokenInfoUrl = tokenInfoUrl;
783829
return this;
784830
}
785831

786-
/** Sets the optional project used for quota and billing purposes. */
832+
/**
833+
* Sets the optional project used for quota and billing purposes.
834+
*
835+
* @param quotaProjectId the quota and billing project id to set
836+
* @return this {@code Builder} object
837+
*/
787838
public Builder setQuotaProjectId(String quotaProjectId) {
788839
this.quotaProjectId = quotaProjectId;
789840
return this;
790841
}
791842

792-
/** Sets the optional client ID of the service account from the console. */
843+
/**
844+
* Sets the optional client ID of the service account from the console.
845+
*
846+
* @param clientId the service account client id to set
847+
* @return this {@code Builder} object
848+
*/
793849
public Builder setClientId(String clientId) {
794850
this.clientId = clientId;
795851
return this;
796852
}
797853

798-
/** Sets the optional client secret of the service account from the console. */
854+
/**
855+
* Sets the optional client secret of the service account from the console.
856+
*
857+
* @param clientSecret the service account client secret to set
858+
* @return this {@code Builder} object
859+
*/
799860
public Builder setClientSecret(String clientSecret) {
800861
this.clientSecret = clientSecret;
801862
return this;
802863
}
803864

804-
/** Sets the optional scopes to request during the authorization grant. */
865+
/**
866+
* Sets the optional scopes to request during the authorization grant.
867+
*
868+
* @param scopes the request scopes to set
869+
* @return this {@code Builder} object
870+
*/
805871
public Builder setScopes(Collection<String> scopes) {
806872
this.scopes = scopes;
807873
return this;
@@ -811,18 +877,32 @@ public Builder setScopes(Collection<String> scopes) {
811877
* Sets the optional workforce pool user project number when the credential corresponds to a
812878
* workforce pool and not a workload identity pool. The underlying principal must still have
813879
* serviceusage.services.use IAM permission to use the project for billing/quota.
880+
*
881+
* @param workforcePoolUserProject the workforce pool user project number to set
882+
* @return this {@code Builder} object
814883
*/
815884
public Builder setWorkforcePoolUserProject(String workforcePoolUserProject) {
816885
this.workforcePoolUserProject = workforcePoolUserProject;
817886
return this;
818887
}
819888

820-
/** Sets the optional service account impersonation options. */
889+
/**
890+
* Sets the optional service account impersonation options.
891+
*
892+
* @param optionsMap the service account impersonation options to set
893+
* @return this {@code Builder} object
894+
*/
821895
public Builder setServiceAccountImpersonationOptions(Map<String, Object> optionsMap) {
822896
this.serviceAccountImpersonationOptions = new ServiceAccountImpersonationOptions(optionsMap);
823897
return this;
824898
}
825899

900+
/**
901+
* Sets the optional Environment Provider.
902+
*
903+
* @param environmentProvider the {@code EnvironmentProvider} to set
904+
* @return this {@code Builder} object
905+
*/
826906
Builder setEnvironmentProvider(EnvironmentProvider environmentProvider) {
827907
this.environmentProvider = environmentProvider;
828908
return this;

oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentials.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@
8484
* "code": "401",
8585
* "message": "Error message."
8686
* }
87+
* </pre>
8788
*
88-
* <p> The `expiration_time` field in the JSON response is only required for successful
89-
* responses when an output file was specified in the credential configuration.
89+
* <p>The `expiration_time` field in the JSON response is only required for successful responses
90+
* when an output file was specified in the credential configuration.
9091
*
91-
* The auth libraries will populate certain environment variables that will be accessible by the
92+
* <p>The auth libraries will populate certain environment variables that will be accessible by the
9293
* executable, such as: GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE, GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE,
9394
* GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE, GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL, and
9495
* GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE.
9596
*
9697
* <p>Please see this repositories README for a complete executable request/response specification.
97-
* </pre>
9898
*/
9999
public class PluggableAuthCredentials extends ExternalAccountCredentials {
100100

0 commit comments

Comments
 (0)