applicationTokenCertificateCredentials.d.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { ApplicationTokenCredentialsBase } from "./applicationTokenCredentialsBase";
  2. import { Environment } from "@azure/ms-rest-azure-env";
  3. import { TokenAudience } from "../util/authConstants";
  4. import { TokenResponse, TokenCache } from "adal-node";
  5. import { AzureTokenCredentialsOptions } from "../login";
  6. export declare class ApplicationTokenCertificateCredentials extends ApplicationTokenCredentialsBase {
  7. readonly certificate: string;
  8. readonly thumbprint: string;
  9. /**
  10. * Creates a new ApplicationTokenCredentials object.
  11. * See {@link https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-dotnet/ Active Directory Quickstart for .Net}
  12. * for detailed instructions on creating an Azure Active Directory application.
  13. * @constructor
  14. * @param {string} clientId The active directory application client id.
  15. * @param {string} domain The domain or tenant id containing this application.
  16. * @param {string} certificate A PEM encoded certificate private key.
  17. * @param {string} thumbprint A hex encoded thumbprint of the certificate.
  18. * @param {string} [tokenAudience] The audience for which the token is requested. Valid values are 'graph', 'batch', or any other resource like 'https://vault.azure.net/'.
  19. * If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferrably in a guid format).
  20. * @param {Environment} [environment] The azure environment to authenticate with.
  21. * @param {object} [tokenCache] The token cache. Default value is the MemoryCache object from adal.
  22. */
  23. constructor(clientId: string, domain: string, certificate: string, thumbprint: string, tokenAudience?: TokenAudience, environment?: Environment, tokenCache?: TokenCache);
  24. /**
  25. * Tries to get the token from cache initially. If that is unsuccessfull then it tries to get the token from ADAL.
  26. * @returns {Promise<TokenResponse>} A promise that resolves to TokenResponse and rejects with an Error.
  27. */
  28. getToken(): Promise<TokenResponse>;
  29. /**
  30. * Creates a new instance of ApplicationTokenCertificateCredentials.
  31. *
  32. * @param clientId The active directory application client id also known as the SPN (ServicePrincipal Name).
  33. * See {@link https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-dotnet/ Active Directory Quickstart for .Net}
  34. * for an example.
  35. * @param {string} certificateStringOrFilePath A PEM encoded certificate and private key OR an absolute filepath to the .pem file containing that information. For example:
  36. * - CertificateString: "-----BEGIN PRIVATE KEY-----\n<xxxxx>\n-----END PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\n<yyyyy>\n-----END CERTIFICATE-----\n"
  37. * - CertificateFilePath: **Absolute** file path of the .pem file.
  38. * @param domain The domain or tenant id containing this application.
  39. * @param options AzureTokenCredentialsOptions - Object representing optional parameters.
  40. *
  41. * @returns ApplicationTokenCertificateCredentials
  42. */
  43. static create(clientId: string, certificateStringOrFilePath: string, domain: string, options: AzureTokenCredentialsOptions): ApplicationTokenCertificateCredentials;
  44. }
  45. //# sourceMappingURL=applicationTokenCertificateCredentials.d.ts.map