tokenCredentialsBase.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. import { WebResource } from "@azure/ms-rest-js";
  2. import { Environment } from "@azure/ms-rest-azure-env";
  3. import { TokenClientCredentials } from "./tokenClientCredentials";
  4. import { TokenResponse, AuthenticationContext, TokenCache } from "adal-node";
  5. export declare abstract class TokenCredentialsBase implements TokenClientCredentials {
  6. readonly clientId: string;
  7. domain: string;
  8. readonly tokenAudience?: string | undefined;
  9. readonly environment: Environment;
  10. tokenCache: TokenCache;
  11. readonly authContext: AuthenticationContext;
  12. constructor(clientId: string, domain: string, tokenAudience?: string | undefined, environment?: Environment, tokenCache?: TokenCache);
  13. protected getActiveDirectoryResourceId(): string;
  14. protected getTokenFromCache(username?: string): Promise<TokenResponse>;
  15. /**
  16. * Tries to get the token from cache initially. If that is unsuccessful then it tries to get the token from ADAL.
  17. * @returns {Promise<TokenResponse>}
  18. * {object} [tokenResponse] The tokenResponse (tokenType and accessToken are the two important properties).
  19. * @memberof TokenCredentialsBase
  20. */
  21. abstract getToken(): Promise<TokenResponse>;
  22. /**
  23. * Signs a request with the Authentication header.
  24. *
  25. * @param {webResource} The WebResource to be signed.
  26. * @param {function(error)} callback The callback function.
  27. * @return {undefined}
  28. */
  29. signRequest(webResource: WebResource): Promise<WebResource>;
  30. }
  31. //# sourceMappingURL=tokenCredentialsBase.d.ts.map