Skip to content
Snippets Groups Projects
Commit 2ef8f03c authored by Lansana DIOMANDE's avatar Lansana DIOMANDE
Browse files

refactor: use config.ts to handle value of REJECT_UNAUTHORIZED

parent 0c0383b3
Branches
Tags
2 merge requests!14feat: added mounted, .bashrc, .zshrc, added tests, added keycloak tests,!8feat(extension): login, open in devcontainer, automaticly save code, open briefing, publish extension
......@@ -2,3 +2,4 @@ export const KEYCLOAK_DEVICE_AUTH_URL =
'https://auth.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/auth/device';
export const KEYCLOAK_TOKEN_CREATE_URL = 'https://auth.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/token';
export const KEYCLOAK_USER_INFO_URL = 'https://auth.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/userinfo';
export const REJECT_UNAUTHORIZED = true;
......@@ -4,3 +4,4 @@ export const KEYCLOAK_TOKEN_CREATE_URL =
'https://auth.staging.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/token';
export const KEYCLOAK_USER_INFO_URL =
'https://auth.staging.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/userinfo';
export const REJECT_UNAUTHORIZED = true;
......@@ -4,3 +4,4 @@ export const KEYCLOAK_TOKEN_CREATE_URL =
'https://auth.dev.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/token';
export const KEYCLOAK_USER_INFO_URL =
'https://auth.dev.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/userinfo';
export const REJECT_UNAUTHORIZED = false;
......@@ -3,8 +3,9 @@ import fetch, { Response } from 'node-fetch';
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'] = '0'; // TODO: remove when SSL will work
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = REJECT_UNAUTHORIZED ? '1' : '0'; // TODO: remove when SSL will work
export default class KeycloakOAuth2DeviceFlowConnection {
private waitDuration: WaitDuration;
......@@ -39,7 +40,7 @@ export default class KeycloakOAuth2DeviceFlowConnection {
Authorization: `Bearer ${accessToken}`,
},
body: '',
agent: new https.Agent({ rejectUnauthorized: false }), // TODO: remove when SSL will work
agent: new https.Agent({ rejectUnauthorized: REJECT_UNAUTHORIZED }), // TODO: remove when SSL will work
});
const tokenValidationRequestResponseCode = tokenValidationRequestResponse.status;
switch (tokenValidationRequestResponseCode) {
......@@ -126,7 +127,7 @@ export default class KeycloakOAuth2DeviceFlowConnection {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: body,
agent: new https.Agent({ rejectUnauthorized: false }), // TODO: remove when SSL will work
agent: new https.Agent({ rejectUnauthorized: REJECT_UNAUTHORIZED }), // TODO: remove when SSL will work
});
}
......@@ -146,7 +147,7 @@ export default class KeycloakOAuth2DeviceFlowConnection {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: body,
agent: new https.Agent({ rejectUnauthorized: false }), // TODO: remove when SSL will work
agent: new https.Agent({ rejectUnauthorized: REJECT_UNAUTHORIZED }), // TODO: remove when SSL will work
});
userAuthenticationRequestResponseCode = userAuthenticationRequestResponse.status;
switch (userAuthenticationRequestResponseCode) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment