MCPcopy
hub / github.com/vpulim/node-soap / BasicAuthSecurity

Class BasicAuthSecurity

src/security/BasicAuthSecurity.ts:4–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import { merge } from '../utils';
3
4export class BasicAuthSecurity implements ISecurity {
5 private _username: string;
6 private _password: string;
7 private defaults;
8
9 constructor(username: string, password: string, defaults?: any) {
10 this._username = username;
11 this._password = password;
12 this.defaults = {};
13 merge(this.defaults, defaults);
14 }
15
16 public addHeaders(headers: IHeaders): void {
17 headers.Authorization = 'Basic ' + Buffer.from(this._username + ':' + this._password || '').toString('base64');
18 }
19
20 public toXML(): string {
21 return '';
22 }
23
24 public addOptions(options: any): void {
25 merge(options, this.defaults);
26 }
27}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected