Codota Logo
ServiceAccountJwtAccessCredentials.sign
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: googleapis/google-auth-library-java

@Test
public void sign_sameAs()
  throws IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException {
 PrivateKey privateKey = ServiceAccountCredentials.privateKeyFromPkcs8(SA_PRIVATE_KEY_PKCS8);
 byte[] toSign = {0xD, 0xE, 0xA, 0xD};
 ServiceAccountJwtAccessCredentials credentials = ServiceAccountJwtAccessCredentials.newBuilder()
   .setClientId(SA_CLIENT_ID)
   .setClientEmail(SA_CLIENT_EMAIL)
   .setPrivateKey(privateKey)
   .setPrivateKeyId(SA_PRIVATE_KEY_ID)
   .build();
 byte[] signedBytes = credentials.sign(toSign);
 Signature signature = Signature.getInstance(OAuth2Utils.SIGNATURE_ALGORITHM);
 signature.initSign(credentials.getPrivateKey());
 signature.update(toSign);
 assertArrayEquals(signature.sign(), signedBytes);
}
com.google.auth.oauth2ServiceAccountJwtAccessCredentialssign

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
  • 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
  • equals,
  • fromJson,
  • getAccount,
  • getJwtAccess,
  • getRequestMetadata,
  • hashCode,
  • toString

Popular in Java

  • Reactive rest calls using spring rest template
  • getSystemService (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now