Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b020b47

Browse filesBrowse files
authored
Documentation for ComputeEngineCredential signing. (#176)
Adding note about enabling the IAM API and requiring the iam.serviceAccounts.signBlob permission.
1 parent 1c726e9 commit b020b47
Copy full SHA for b020b47

1 file changed

+15-1Lines changed: 15 additions & 1 deletion

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java‎

Copy file name to clipboardExpand all lines: google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java
+15-1Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@
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
*/
6669
public 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();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.