@@ -64,7 +64,7 @@ open class CoderProtocolHandler(
6464
6565 context.logger.info(" Handling $uri ..." )
6666 val deploymentURL = resolveDeploymentUrl(params) ? : return
67- val token = resolveToken(params) ? : return
67+ val token = if ( ! context.settingsStore.requireTokenAuth) null else resolveToken(params) ? : return
6868 val workspaceName = resolveWorkspaceName(params) ? : return
6969 val restClient = buildRestClient(deploymentURL, token) ? : return
7070 val workspace = restClient.workspaces().matchName(workspaceName, deploymentURL) ? : return
@@ -128,7 +128,7 @@ open class CoderProtocolHandler(
128128 return workspace
129129 }
130130
131- private suspend fun buildRestClient (deploymentURL : String , token : String ): CoderRestClient ? {
131+ private suspend fun buildRestClient (deploymentURL : String , token : String? ): CoderRestClient ? {
132132 try {
133133 return authenticate(deploymentURL, token)
134134 } catch (ex: Exception ) {
@@ -140,11 +140,11 @@ open class CoderProtocolHandler(
140140 /* *
141141 * Returns an authenticated Coder CLI.
142142 */
143- private suspend fun authenticate (deploymentURL : String , token : String ): CoderRestClient {
143+ private suspend fun authenticate (deploymentURL : String , token : String? ): CoderRestClient {
144144 val client = CoderRestClient (
145145 context,
146146 deploymentURL.toURL(),
147- if (settings.requireTokenAuth) token else null ,
147+ token,
148148 PluginManager .pluginInfo.version
149149 )
150150 client.initializeSession()
0 commit comments