Tabnine Logo
ServiceAccountJwtAccessCredentials.fromPkcs8
Code IndexAdd Tabnine to your IDE (free)

How to use
fromPkcs8
method
in
com.google.auth.oauth2.ServiceAccountJwtAccessCredentials

Best Java code snippets using com.google.auth.oauth2.ServiceAccountJwtAccessCredentials.fromPkcs8 (Showing top 7 results out of 315)

origin: googleapis/google-auth-library-java

/**
 * Factory using PKCS#8 for the private key.
 *
 * @param clientId Client ID of the service account from the console. May be null.
 * @param clientEmail Client email address of the service account from the console.
 * @param privateKeyPkcs8 RSA private key object for the service account in PKCS#8 format.
 * @param privateKeyId Private key identifier for the service account. May be null.
 * @return New ServiceAccountJwtAcceessCredentials created from a private key.
 * @throws IOException if the credential cannot be created from the private key.
 */
public static ServiceAccountJwtAccessCredentials fromPkcs8(String clientId, String clientEmail, 
  String privateKeyPkcs8, String privateKeyId) throws IOException {
 return fromPkcs8(clientId, clientEmail, privateKeyPkcs8, privateKeyId, null);
}
origin: com.google.auth/google-auth-library-oauth2-http

/**
 * Factory using PKCS#8 for the private key.
 *
 * @param clientId Client ID of the service account from the console. May be null.
 * @param clientEmail Client email address of the service account from the console.
 * @param privateKeyPkcs8 RSA private key object for the service account in PKCS#8 format.
 * @param privateKeyId Private key identifier for the service account. May be null.
 * @return New ServiceAccountJwtAcceessCredentials created from a private key.
 * @throws IOException if the credential cannot be created from the private key.
 */
public static ServiceAccountJwtAccessCredentials fromPkcs8(String clientId, String clientEmail, 
  String privateKeyPkcs8, String privateKeyId) throws IOException {
 return fromPkcs8(clientId, clientEmail, privateKeyPkcs8, privateKeyId, null);
}
origin: com.google.auth/google-auth-library-oauth2-http

/**
 * Returns service account credentials defined by JSON using the format supported by the Google
 * Developers Console.
 *
 * @param json a map from the JSON representing the credentials.
 * @param defaultAudience Audience to use if not provided by transport. May be null.
 * @return the credentials defined by the JSON.
 * @throws IOException if the credential cannot be created from the JSON.
 **/
static ServiceAccountJwtAccessCredentials fromJson(Map<String, Object> json, URI defaultAudience)
  throws IOException {
 String clientId = (String) json.get("client_id");
 String clientEmail = (String) json.get("client_email");
 String privateKeyPkcs8 = (String) json.get("private_key");
 String privateKeyId = (String) json.get("private_key_id");
 if (clientId == null || clientEmail == null
   || privateKeyPkcs8 == null || privateKeyId == null) {
  throw new IOException("Error reading service account credential from JSON, "
    + "expecting  'client_id', 'client_email', 'private_key' and 'private_key_id'.");
 }
 return fromPkcs8(clientId, clientEmail, privateKeyPkcs8, privateKeyId, defaultAudience);
}
origin: googleapis/google-auth-library-java

/**
 * Returns service account credentials defined by JSON using the format supported by the Google
 * Developers Console.
 *
 * @param json a map from the JSON representing the credentials.
 * @param defaultAudience Audience to use if not provided by transport. May be null.
 * @return the credentials defined by the JSON.
 * @throws IOException if the credential cannot be created from the JSON.
 **/
static ServiceAccountJwtAccessCredentials fromJson(Map<String, Object> json, URI defaultAudience)
  throws IOException {
 String clientId = (String) json.get("client_id");
 String clientEmail = (String) json.get("client_email");
 String privateKeyPkcs8 = (String) json.get("private_key");
 String privateKeyId = (String) json.get("private_key_id");
 if (clientId == null || clientEmail == null
   || privateKeyPkcs8 == null || privateKeyId == null) {
  throw new IOException("Error reading service account credential from JSON, "
    + "expecting  'client_id', 'client_email', 'private_key' and 'private_key_id'.");
 }
 return fromPkcs8(clientId, clientEmail, privateKeyPkcs8, privateKeyId, defaultAudience);
}
origin: googleapis/google-auth-library-java

@Test
public void getAuthenticationType_returnsJwtAccess() throws IOException {
 Credentials credentials = ServiceAccountJwtAccessCredentials
   .fromPkcs8(SA_CLIENT_ID, SA_CLIENT_EMAIL, SA_PRIVATE_KEY_PKCS8, SA_PRIVATE_KEY_ID);
 assertEquals(credentials.getAuthenticationType(), "JWTAccess");
}
origin: googleapis/google-auth-library-java

@Test
public void hasRequestMetadata_returnsTrue() throws IOException {
 Credentials credentials = ServiceAccountJwtAccessCredentials
   .fromPkcs8(SA_CLIENT_ID, SA_CLIENT_EMAIL, SA_PRIVATE_KEY_PKCS8, SA_PRIVATE_KEY_ID);
 assertTrue(credentials.hasRequestMetadata());
}
origin: googleapis/google-auth-library-java

@Test
public void hasRequestMetadataOnly_returnsTrue() throws IOException {
 Credentials credentials = ServiceAccountJwtAccessCredentials
   .fromPkcs8(SA_CLIENT_ID, SA_CLIENT_EMAIL, SA_PRIVATE_KEY_PKCS8, SA_PRIVATE_KEY_ID);
 assertTrue(credentials.hasRequestMetadataOnly());
}
com.google.auth.oauth2ServiceAccountJwtAccessCredentialsfromPkcs8

Javadoc

Factory using PKCS#8 for the private key.

Popular methods of ServiceAccountJwtAccessCredentials

  • newBuilder
  • getClientEmail
  • getPrivateKey
  • fromStream
    Returns credentials defined by a Service Account key file in JSON format from the Google Developers
  • getClientId
  • getPrivateKeyId
  • <init>
    Constructor with full information.
  • blockingGetToCallback
  • createCache
  • equals
  • fromJson
    Returns service account credentials defined by JSON using the format supported by the Google Develop
  • getAccount
  • fromJson,
  • getAccount,
  • getJwtAccess,
  • getRequestMetadata,
  • hashCode,
  • sign,
  • toString

Popular in Java

  • Reactive rest calls using spring rest template
  • notifyDataSetChanged (ArrayAdapter)
  • getApplicationContext (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JPanel (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now