public class ServiceAccountJwtAccessCredentials extends Credentials
Uses a JSON Web Token (JWT) directly in the request metadata to provide authorization.
| Constructor and Description |
|---|
ServiceAccountJwtAccessCredentials(String clientId,
String clientEmail,
PrivateKey privateKey,
String privateKeyId)
Constructor with minimum identifying information.
|
ServiceAccountJwtAccessCredentials(String clientId,
String clientEmail,
PrivateKey privateKey,
String privateKeyId,
URI defaultAudience)
Constructor with full information.
|
| Modifier and Type | Method and Description |
|---|---|
static ServiceAccountJwtAccessCredentials |
fromPkcs8(String clientId,
String clientEmail,
String privateKeyPkcs8,
String privateKeyId)
Factory using PKCS#8 for the private key.
|
static ServiceAccountJwtAccessCredentials |
fromPkcs8(String clientId,
String clientEmail,
String privateKeyPkcs8,
String privateKeyId,
URI defaultAudience)
Factory using PKCS#8 for the private key.
|
String |
getAuthenticationType() |
String |
getClientEmail() |
String |
getClientId() |
PrivateKey |
getPrivateKey() |
String |
getPrivateKeyId() |
Map<String,List<String>> |
getRequestMetadata(URI uri)
Provide the request metadata by putting an access JWT directly in the metadata.
|
boolean |
hasRequestMetadata() |
boolean |
hasRequestMetadataOnly() |
void |
refresh()
Discard any cached data
|
getRequestMetadatapublic ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId)
clientId - Client ID of the service account from the console. May be null.clientEmail - Client email address of the service account from the console.privateKey - RSA private key object for the service account.privateKeyId - Private key identifier for the service account. May be null.public ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId, URI defaultAudience)
clientId - Client ID of the service account from the console. May be null.clientEmail - Client email address of the service account from the console.privateKey - RSA private key object for the service account.privateKeyId - Private key identifier for the service account. May be null.defaultAudience - Audience to use if not provided by transport. May be null.public static ServiceAccountJwtAccessCredentials fromPkcs8(String clientId, String clientEmail, String privateKeyPkcs8, String privateKeyId) throws IOException
clientId - Client ID of the service account from the console. May be null.clientEmail - Client email address of the service account from the console.privateKeyPkcs8 - RSA private key object for the service account in PKCS#8 format.privateKeyId - Private key identifier for the service account. May be null.IOExceptionpublic static ServiceAccountJwtAccessCredentials fromPkcs8(String clientId, String clientEmail, String privateKeyPkcs8, String privateKeyId, URI defaultAudience) throws IOException
clientId - Client ID of the service account from the console. May be null.clientEmail - Client email address of the service account from the console.privateKeyPkcs8 - RSA private key object for the service account in PKCS#8 format.privateKeyId - Private key identifier for the service account. May be null.defaultAudience - Audience to use if not provided by transport. May be null.IOExceptionpublic String getAuthenticationType()
getAuthenticationType in class Credentialspublic boolean hasRequestMetadata()
hasRequestMetadata in class Credentialspublic boolean hasRequestMetadataOnly()
hasRequestMetadataOnly in class Credentialspublic Map<String,List<String>> getRequestMetadata(URI uri) throws IOException
getRequestMetadata in class CredentialsIOExceptionpublic void refresh()
refresh in class Credentialspublic final String getClientId()
public final String getClientEmail()
public final PrivateKey getPrivateKey()
public final String getPrivateKeyId()
Copyright © 2015 Google. All rights reserved.