| 2 | import { merge } from '../utils'; |
| 3 | |
| 4 | export 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected