import { RequestInit, Response } from 'node-fetch'; import http from 'http'; import { URL } from 'url'; import { ClientCookie } from './client/ClientCookie'; import { ClientInfo } from './client/ClientInfo'; import { SecuritySupportProvider } from '..'; /** * Allow to fetch url with a system that uses the negotiate protocol. * Cookies are managed if necessary during the process. * * @export * @class Client */ export declare class Client { clientCookie: ClientCookie; clientInfo: ClientInfo; agent: (parsedURL: URL) => http.Agent; /** * Set the credentials for running the client as another user. * * By default, the credentials are the logged windows account. * * @param {string} domain * @param {string} user * @param {string} password * @memberof Client */ setCredentials(domain: string, user: string, password: string): void; /** * Force the targetName to a value. * * For Kerberos, the targetName is the SPN (Service Principal Name). * * @param {string} targetName * @memberof Client */ setTargetName(targetName: string): void; /** * Set the Security Support Provider (NTLM, Kerberos, Negotiate) * * @param {SecuritySupportProvider} ssp * @memberof Client */ setSSP(ssp: SecuritySupportProvider): void; /** * Works as the fetch function of node-fetch node module. * This function can handle the negotiate protocol with SPNEGO tokens. * * @param {string} resource - the URL to fetch * @param {RequestInit} [init] - the options (headers, body, etc.) * @returns {Promise} a promise with the HTTP response. * @memberof Client */ fetch(resource: string, init?: RequestInit): Promise; /** * The authentication negotiate protocol is handled by this function. * It is called by `Client.fetch`. * * @private * @param {Response} response * @param {string} resource * @param {RequestInit} [init={}] * @returns {Promise} * @memberof Client */ private handleAuth; }