Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove request usages from auth & config #1022

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import https = require('https');
import request = require('request');

import { User } from './config_types';

export interface Authenticator {
isAuthProvider(user: User): boolean;
applyAuthentication(user: User, opts: request.Options | https.RequestOptions): Promise<void>;
applyAuthentication(user: User, opts: https.RequestOptions): Promise<void>;
}
7 changes: 3 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import yaml = require('js-yaml');
import net = require('net');
import path = require('path');

import request = require('request');
import shelljs = require('shelljs');

import * as api from './api';
Expand Down Expand Up @@ -459,7 +458,7 @@ export class KubeConfig implements SecurityAuthentication {
return this.getContextObject(this.currentContext);
}

private applyHTTPSOptions(opts: request.Options | https.RequestOptions): void {
private applyHTTPSOptions(opts: https.RequestOptions): void {
const cluster = this.getCurrentCluster();
const user = this.getCurrentUser();
if (!user) {
Expand All @@ -483,7 +482,7 @@ export class KubeConfig implements SecurityAuthentication {
}
}

private async applyAuthorizationHeader(opts: request.Options | https.RequestOptions): Promise<void> {
private async applyAuthorizationHeader(opts: https.RequestOptions): Promise<void> {
const user = this.getCurrentUser();
if (!user) {
return;
Expand All @@ -504,7 +503,7 @@ export class KubeConfig implements SecurityAuthentication {
}
}

private async applyOptions(opts: request.Options | https.RequestOptions): Promise<void> {
private async applyOptions(opts: https.RequestOptions): Promise<void> {
this.applyHTTPSOptions(opts);
await this.applyAuthorizationHeader(opts);
}
Expand Down