From e0174be017f21f6bef6ce1dee94a8353c4a62c59 Mon Sep 17 00:00:00 2001
From: Christian Zheng <czheng@takima.fr>
Date: Mon, 25 Apr 2022 13:56:16 +0200
Subject: [PATCH] refactor(login): minor renaming + remove comment

---
 .../core/keycloakOAuth2DeviceFlowConnection.ts   | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts b/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts
index c57b5b05..9ff0ef5f 100644
--- a/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts
+++ b/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts
@@ -1,11 +1,11 @@
 import * as https from 'https';
 import fetch, { Response } from 'node-fetch';
+import { REJECT_UNAUTHORIZED } from '../config';
 import { HttpStatusCode } from '../customTypings/HttpStatusCode';
 import { TokenFetchErrorCode } from '../customTypings/KeycloakAPITypes';
 import { error as err, log } from '../recorder/utils';
-import { REJECT_UNAUTHORIZED } from '../config';
 
-process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = REJECT_UNAUTHORIZED ? '1' : '0'; // TODO: remove when SSL will work
+process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = REJECT_UNAUTHORIZED ? '1' : '0';
 
 export default class KeycloakOAuth2DeviceFlowConnection {
   private waitDuration: WaitDuration;
@@ -13,7 +13,7 @@ export default class KeycloakOAuth2DeviceFlowConnection {
   private refreshToken: string;
   private deviceAuthorizationRequestResponseData: DeviceAuthorizationRequestResponseData;
 
-  constructor(private deviceUrl: string, private tokenUrl: string, private userInfoUrl?: string) {
+  constructor(private deviceUrl: string, private tokenUrl: string, private userInfoUrl: string) {
     this.waitDuration = new WaitDuration([5_000, 5_000, 5_000, 10_000, 10_000, 10_000, 30_000, 30_000, 100_000]);
     this.accessToken = '';
     this.refreshToken = '';
@@ -40,7 +40,7 @@ export default class KeycloakOAuth2DeviceFlowConnection {
         Authorization: `Bearer ${accessToken}`,
       },
       body: '',
-      agent: new https.Agent({ rejectUnauthorized: REJECT_UNAUTHORIZED }), // TODO: remove when SSL will work
+      agent: new https.Agent({ rejectUnauthorized: REJECT_UNAUTHORIZED }),
     });
     const tokenValidationRequestResponseCode = tokenValidationRequestResponse.status;
     switch (tokenValidationRequestResponseCode) {
@@ -77,7 +77,7 @@ export default class KeycloakOAuth2DeviceFlowConnection {
       });
       return Promise.resolve({ accessToken: this.accessToken, refreshToken: this.refreshToken });
     }
-    if (!this._deviceIsRegistered()) {
+    if (!this.deviceIsRegistered()) {
       await this.registerDevice();
     }
     try {
@@ -100,7 +100,7 @@ export default class KeycloakOAuth2DeviceFlowConnection {
     }
   }
 
-  private _deviceIsRegistered(): boolean {
+  private deviceIsRegistered(): boolean {
     return !!this.deviceAuthorizationRequestResponseData.device_code;
   }
 
@@ -127,7 +127,7 @@ export default class KeycloakOAuth2DeviceFlowConnection {
         'Content-Type': 'application/x-www-form-urlencoded',
       },
       body: body,
-      agent: new https.Agent({ rejectUnauthorized: REJECT_UNAUTHORIZED }), // TODO: remove when SSL will work
+      agent: new https.Agent({ rejectUnauthorized: REJECT_UNAUTHORIZED }),
     });
   }
 
@@ -147,7 +147,7 @@ export default class KeycloakOAuth2DeviceFlowConnection {
           'Content-Type': 'application/x-www-form-urlencoded',
         },
         body: body,
-        agent: new https.Agent({ rejectUnauthorized: REJECT_UNAUTHORIZED }), // TODO: remove when SSL will work
+        agent: new https.Agent({ rejectUnauthorized: REJECT_UNAUTHORIZED }),
       });
       userAuthenticationRequestResponseCode = userAuthenticationRequestResponse.status;
       switch (userAuthenticationRequestResponseCode) {
-- 
GitLab