From 65da8502a6e1193847775d5ce1069643f84ffd20 Mon Sep 17 00:00:00 2001
From: Christian Zheng <czheng@takima.fr>
Date: Wed, 13 Apr 2022 14:21:51 +0200
Subject: [PATCH] refactor(login): add config file for static keycloak urls

---
 deadlock-plugins/deadlock-extension/src/config.ts          | 6 ++++++
 deadlock-plugins/deadlock-extension/src/core/controller.ts | 7 ++++---
 2 files changed, 10 insertions(+), 3 deletions(-)
 create mode 100644 deadlock-plugins/deadlock-extension/src/config.ts

diff --git a/deadlock-plugins/deadlock-extension/src/config.ts b/deadlock-plugins/deadlock-extension/src/config.ts
new file mode 100644
index 00000000..342a5bc0
--- /dev/null
+++ b/deadlock-plugins/deadlock-extension/src/config.ts
@@ -0,0 +1,6 @@
+export const KEYCLOAK_DEVICE_AUTH_URL =
+	'https://auth.dev.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/auth/device';
+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';
diff --git a/deadlock-plugins/deadlock-extension/src/core/controller.ts b/deadlock-plugins/deadlock-extension/src/core/controller.ts
index 49076a78..4a8cc8a1 100644
--- a/deadlock-plugins/deadlock-extension/src/core/controller.ts
+++ b/deadlock-plugins/deadlock-extension/src/core/controller.ts
@@ -1,4 +1,5 @@
 import * as vscode from 'vscode';
+import { KEYCLOAK_DEVICE_AUTH_URL, KEYCLOAK_TOKEN_CREATE_URL, KEYCLOAK_USER_INFO_URL } from '../config';
 import { OPEN_GETTING_STARTED_COMMAND } from '../theia/command';
 import BriefingView from '../view/briefingView';
 import GettingStartedView from '../view/gettingStartedView';
@@ -16,9 +17,9 @@ export default class Controller {
 		this.gettingStartedView = new GettingStartedView(context.extensionUri);
 		this.commandHandler = new CommandHandler(this);
 		this.connection = new KeycloakOAuth2DeviceFlowConnection(
-			'https://auth.dev.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/auth/device',
-			'https://auth.dev.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/token',
-			'https://auth.dev.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/userinfo',
+			KEYCLOAK_DEVICE_AUTH_URL,
+			KEYCLOAK_TOKEN_CREATE_URL,
+			KEYCLOAK_USER_INFO_URL,
 		);
 
 		this.init();
-- 
GitLab