Skip to content

Commit

Permalink
Merge pull request #1022 from davidgamero/davidgamero/request-migrati…
Browse files Browse the repository at this point in the history
…on-auth

remove request usages from auth & config
  • Loading branch information
k8s-ci-robot committed Mar 26, 2023
2 parents d9626f9 + fa56f36 commit 6bfed83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
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

0 comments on commit 6bfed83

Please sign in to comment.