@elastic.io/component-commons-library
Version:
Library for most common component development cases
21 lines (16 loc) • 453 B
text/typescript
import { NoAuthRestClient } from './NoAuthRestClient';
export class BasicAuthRestClient extends NoAuthRestClient {
username: string;
password: string;
constructor(emitter, cfg) {
super(emitter, cfg);
this.username = cfg.username;
this.password = cfg.password;
}
protected addAuthenticationToRequestOptions(requestOptions) {
requestOptions.auth = {
username: this.username,
password: this.password,
};
}
}