Class JWTUtils


  • public class JWTUtils
    extends Object
    JWTUtils class.
    • Constructor Detail

      • JWTUtils

        public JWTUtils()
    • Method Detail

      • generateJWTAssertionFromByteArray

        public static String generateJWTAssertionFromByteArray​(byte[] rsaPrivateKey,
                                                               String oAuthBasePath,
                                                               String clientId,
                                                               String userId,
                                                               long expiresIn,
                                                               String scopes)
                                                        throws IllegalArgumentException,
                                                               com.auth0.jwt.exceptions.JWTCreationException,
                                                               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:
        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
        IOException - if there is an issue with either the public or private file
      • generateJWTAssertion

        public static String generateJWTAssertion​(String publicKeyFilename,
                                                  String privateKeyFilename,
                                                  String oAuthBasePath,
                                                  String clientId,
                                                  String userId,
                                                  long expiresIn)
                                           throws com.auth0.jwt.exceptions.JWTCreationException,
                                                  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
        IOException - if there is an issue with either the public or private file
      • generateJWTAssertion

        public static String generateJWTAssertion​(String publicKeyFilename,
                                                  String privateKeyFilename,
                                                  String oAuthBasePath,
                                                  String clientId,
                                                  String userId,
                                                  long expiresIn,
                                                  String scopes)
                                           throws com.auth0.jwt.exceptions.JWTCreationException,
                                                  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
        IOException - if there is an issue with either the public or private file