mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-10-19 20:41:12 +08:00
25 lines
947 B
JavaScript
25 lines
947 B
JavaScript
|
"use strict";
|
||
|
// Copyright (c) Microsoft. All rights reserved.
|
||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
class BasicCredentialHandler {
|
||
|
constructor(username, password) {
|
||
|
this.username = username;
|
||
|
this.password = password;
|
||
|
}
|
||
|
// currently implements pre-authorization
|
||
|
// TODO: support preAuth = false where it hooks on 401
|
||
|
prepareRequest(options) {
|
||
|
options.headers['Authorization'] = 'Basic ' + new Buffer(this.username + ':' + this.password).toString('base64');
|
||
|
options.headers['X-TFS-FedAuthRedirect'] = 'Suppress';
|
||
|
}
|
||
|
// This handler cannot handle 401
|
||
|
canHandleAuthentication(response) {
|
||
|
return false;
|
||
|
}
|
||
|
handleAuthentication(httpClient, requestInfo, objs) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
exports.BasicCredentialHandler = BasicCredentialHandler;
|