File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
oauth2_http/java/com/google/auth/oauth2 Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 6161/**
6262 * OAuth2 credentials representing the built-in service account for a Google Compute Engine VM.
6363 *
64- * <p>Fetches access tokens from the Google Compute Engine metadata server.
64+ * <p>Fetches access tokens from the Google Compute Engine metadata server.</p>
65+ *
66+ * <p>These credentials use the IAM API to sign data. See {@link #sign(byte[])} for more details.
67+ * </p>
6568 */
6669public class ComputeEngineCredentials extends GoogleCredentials implements ServiceAccountSigner {
6770
@@ -294,6 +297,17 @@ public String getAccount() {
294297 return serviceAccountEmail ;
295298 }
296299
300+ /**
301+ * Signs the provided bytes using the private key associated with the service account.
302+ *
303+ * <p>The Compute Engine's project must enable the Identity and Access Management (IAM) API and
304+ * the instance's service account must have the iam.serviceAccounts.signBlob permission.</p>
305+ *
306+ * @param toSign bytes to sign
307+ * @return signed bytes
308+ * @throws SigningException if the attempt to sign the provided bytes failed
309+ * @see <a href="https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/signBlob">Blob Signing</a>
310+ */
297311 @ Override
298312 public byte [] sign (byte [] toSign ) {
299313 BaseEncoding base64 = BaseEncoding .base64 ();
You can’t perform that action at this time.
0 commit comments