public class ServiceAccountJwtAccessCredentials extends Credentials implements ServiceAccountSigner
Uses a JSON Web Token (JWT) directly in the request metadata to provide authorization.
| Modifier and Type | Class and Description |
|---|---|
static class |
ServiceAccountJwtAccessCredentials.Builder |
ServiceAccountSigner.SigningException| Constructor and Description |
|---|
ServiceAccountJwtAccessCredentials(String clientId,
String clientEmail,
PrivateKey privateKey,
String privateKeyId)
Deprecated.
Use
newBuilder() instead. This constructor will either be deleted or made
private in a later version. |
ServiceAccountJwtAccessCredentials(String clientId,
String clientEmail,
PrivateKey privateKey,
String privateKeyId,
URI defaultAudience)
Deprecated.
Use
newBuilder() instead. This constructor will either be deleted or made
private in a later version. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
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.
|
static ServiceAccountJwtAccessCredentials |
fromStream(InputStream credentialsStream)
Returns credentials defined by a Service Account key file in JSON format from the Google
Developers Console.
|
static ServiceAccountJwtAccessCredentials |
fromStream(InputStream credentialsStream,
URI defaultAudience)
Returns credentials defined by a Service Account key file in JSON format from the Google
Developers Console.
|
String |
getAccount() |
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.
|
void |
getRequestMetadata(URI uri,
Executor executor,
RequestMetadataCallback callback) |
int |
hashCode() |
boolean |
hasRequestMetadata() |
boolean |
hasRequestMetadataOnly() |
static ServiceAccountJwtAccessCredentials.Builder |
newBuilder() |
void |
refresh()
Discard any cached data
|
byte[] |
sign(byte[] toSign) |
ServiceAccountJwtAccessCredentials.Builder |
toBuilder() |
String |
toString() |
blockingGetToCallback, getRequestMetadata@Deprecated public ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId)
newBuilder() instead. This constructor will either be deleted or made
private in a later version.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.@Deprecated public ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId, URI defaultAudience)
newBuilder() instead. This constructor will either be deleted or made
private in a later version.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 static ServiceAccountJwtAccessCredentials fromStream(InputStream credentialsStream) throws IOException
credentialsStream - the stream with the credential definition.IOException - if the credential cannot be created from the stream.public static ServiceAccountJwtAccessCredentials fromStream(InputStream credentialsStream, URI defaultAudience) throws IOException
credentialsStream - the stream with the credential definition.defaultAudience - Audience to use if not provided by transport. May be null.IOException - if the credential cannot be created from the stream.public String getAuthenticationType()
getAuthenticationType in class Credentialspublic boolean hasRequestMetadata()
hasRequestMetadata in class Credentialspublic boolean hasRequestMetadataOnly()
hasRequestMetadataOnly in class Credentialspublic void getRequestMetadata(URI uri, Executor executor, RequestMetadataCallback callback)
getRequestMetadata 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()
public String getAccount()
getAccount in interface ServiceAccountSignerpublic byte[] sign(byte[] toSign)
sign in interface ServiceAccountSignerpublic static ServiceAccountJwtAccessCredentials.Builder newBuilder()
public ServiceAccountJwtAccessCredentials.Builder toBuilder()
Copyright © 2017 Google. All rights reserved.