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

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

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

origin: googleapis/gax-java

@Test
public void serviceAccountReplacedWithJwtTokens() throws Exception {
 ServiceAccountCredentials serviceAccountCredentials =
   ServiceAccountCredentials.newBuilder()
     .setClientId("fake-client-id")
     .setClientEmail("fake@example.com")
     .setPrivateKeyId("fake-private-key")
     .setPrivateKey(Mockito.mock(PrivateKey.class))
     .build();
 PowerMockito.mockStatic(GoogleCredentials.class);
 Mockito.when(GoogleCredentials.getApplicationDefault()).thenReturn(serviceAccountCredentials);
 GoogleCredentialsProvider provider =
   GoogleCredentialsProvider.newBuilder()
     .setScopesToApply(ImmutableList.of("scope1", "scope2"))
     .setJwtEnabledScopes(ImmutableList.of("scope1"))
     .build();
 Credentials credentials = provider.getCredentials();
 assertThat(credentials).isInstanceOf(ServiceAccountJwtAccessCredentials.class);
 ServiceAccountJwtAccessCredentials jwtCreds = (ServiceAccountJwtAccessCredentials) credentials;
 assertThat(jwtCreds.getClientId()).isEqualTo(serviceAccountCredentials.getClientId());
 assertThat(jwtCreds.getClientEmail()).isEqualTo(serviceAccountCredentials.getClientEmail());
 assertThat(jwtCreds.getPrivateKeyId()).isEqualTo(serviceAccountCredentials.getPrivateKeyId());
 assertThat(jwtCreds.getPrivateKey()).isEqualTo(serviceAccountCredentials.getPrivateKey());
}
origin: googleapis/google-auth-library-java

@Test 
public void constructor_allParameters_constructs() throws IOException {
 PrivateKey privateKey = ServiceAccountCredentials.privateKeyFromPkcs8(SA_PRIVATE_KEY_PKCS8);
 ServiceAccountJwtAccessCredentials credentials = ServiceAccountJwtAccessCredentials.newBuilder()
   .setClientId(SA_CLIENT_ID)
   .setClientEmail(SA_CLIENT_EMAIL)
   .setPrivateKey(privateKey)
   .setPrivateKeyId(SA_PRIVATE_KEY_ID)
   .build();
 
 assertEquals(SA_CLIENT_ID, credentials.getClientId());
 assertEquals(SA_CLIENT_EMAIL, credentials.getClientEmail());
 assertEquals(privateKey, credentials.getPrivateKey());
 assertEquals(SA_PRIVATE_KEY_ID, credentials.getPrivateKeyId());
}
com.google.auth.oauth2ServiceAccountJwtAccessCredentialsgetPrivateKeyId

Popular methods of ServiceAccountJwtAccessCredentials

  • newBuilder
  • getClientEmail
  • getPrivateKey
  • fromPkcs8
    Factory using PKCS#8 for the private key.
  • fromStream
    Returns credentials defined by a Service Account key file in JSON format from the Google Developers
  • getClientId
  • <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

  • Making http requests using okhttp
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • startActivity (Activity)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • CodeWhisperer alternatives
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