Class JWTUtils


  • public class JWTUtils
    extends java.lang.Object
    JWTUtils class.
    • Constructor Summary

      Constructors 
      Constructor Description
      JWTUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String generateJWTAssertion​(java.lang.String publicKeyFilename, java.lang.String privateKeyFilename, java.lang.String oAuthBasePath, java.lang.String clientId, java.lang.String userId, long expiresIn)
      Helper method to create a JWT token for the JWT flow.
      static java.lang.String generateJWTAssertion​(java.lang.String publicKeyFilename, java.lang.String privateKeyFilename, java.lang.String oAuthBasePath, java.lang.String clientId, java.lang.String userId, long expiresIn, java.lang.String scopes)
      Helper method to create a JWT token for the JWT flow.
      static java.lang.String generateJWTAssertionFromByteArray​(byte[] rsaPrivateKey, java.lang.String oAuthBasePath, java.lang.String clientId, java.lang.String userId, long expiresIn, java.lang.String scopes)
      Helper method to create a JWT token for the JWT flow.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JWTUtils

        public JWTUtils()
    • Method Detail

      • generateJWTAssertionFromByteArray

        public static java.lang.String generateJWTAssertionFromByteArray​(byte[] rsaPrivateKey,
                                                                         java.lang.String oAuthBasePath,
                                                                         java.lang.String clientId,
                                                                         java.lang.String userId,
                                                                         long expiresIn,
                                                                         java.lang.String scopes)
                                                                  throws java.lang.IllegalArgumentException,
                                                                         com.auth0.jwt.exceptions.JWTCreationException,
                                                                         java.io.IOException
        Helper method to create a JWT token for the JWT flow.
        Parameters:
        rsaPrivateKey - the byte contents of the RSA private key
        oAuthBasePath - DocuSign OAuth base path (account-d.docusign.com for the developer sandbox and account.docusign.com for the production platform)
        clientId - DocuSign OAuth Client Id (AKA Integrator Key)
        userId - DocuSign user Id to be impersonated (This is a UUID)
        expiresIn - number of seconds remaining before the JWT assertion is considered as invalid
        scopes - space-separated string that represents the list of scopes to grant to the OAuth token.
        Returns:
        a fresh JWT token
        Throws:
        java.lang.IllegalArgumentException - if one of the arguments is invalid
        com.auth0.jwt.exceptions.JWTCreationException - if not able to create a JWT token from the input parameters
        java.io.IOException - if there is an issue with either the public or private file
      • generateJWTAssertion

        public static java.lang.String generateJWTAssertion​(java.lang.String publicKeyFilename,
                                                            java.lang.String privateKeyFilename,
                                                            java.lang.String oAuthBasePath,
                                                            java.lang.String clientId,
                                                            java.lang.String userId,
                                                            long expiresIn)
                                                     throws com.auth0.jwt.exceptions.JWTCreationException,
                                                            java.io.IOException
        Helper method to create a JWT token for the JWT flow.
        Parameters:
        publicKeyFilename - the filename of the RSA public key
        privateKeyFilename - the filename of the RSA private key
        oAuthBasePath - DocuSign OAuth base path (account-d.docusign.com for the developer sandbox and account.docusign.com for the production platform)
        clientId - DocuSign OAuth Client Id (AKA Integrator Key)
        userId - DocuSign user Id to be impersonated (This is a UUID)
        expiresIn - number of seconds remaining before the JWT assertion is considered as invalid
        Returns:
        a fresh JWT token
        Throws:
        com.auth0.jwt.exceptions.JWTCreationException - if not able to create a JWT token from the input parameters
        java.io.IOException - if there is an issue with either the public or private file
      • generateJWTAssertion

        public static java.lang.String generateJWTAssertion​(java.lang.String publicKeyFilename,
                                                            java.lang.String privateKeyFilename,
                                                            java.lang.String oAuthBasePath,
                                                            java.lang.String clientId,
                                                            java.lang.String userId,
                                                            long expiresIn,
                                                            java.lang.String scopes)
                                                     throws com.auth0.jwt.exceptions.JWTCreationException,
                                                            java.io.IOException
        Helper method to create a JWT token for the JWT flow.
        Parameters:
        publicKeyFilename - the filename of the RSA public key
        privateKeyFilename - the filename of the RSA private key
        oAuthBasePath - DocuSign OAuth base path (account-d.docusign.com for the developer sandbox and account.docusign.com for the production platform)
        clientId - DocuSign OAuth Client Id (AKA Integrator Key)
        userId - DocuSign user Id to be impersonated (This is a UUID)
        expiresIn - number of seconds remaining before the JWT assertion is considered as invalid
        scopes - space-separated string that represents the list of scopes to grant to the OAuth token.
        Returns:
        a fresh JWT token
        Throws:
        com.auth0.jwt.exceptions.JWTCreationException - if not able to create a JWT token from the input parameters
        java.io.IOException - if there is an issue with either the public or private file