@@ -64,7 +64,7 @@ open class CoderProtocolHandler(
64
64
65
65
context.logger.info(" Handling $uri ..." )
66
66
val deploymentURL = resolveDeploymentUrl(params) ? : return
67
- val token = resolveToken(params) ? : return
67
+ val token = if ( ! context.settingsStore.requireTokenAuth) null else resolveToken(params) ? : return
68
68
val workspaceName = resolveWorkspaceName(params) ? : return
69
69
val restClient = buildRestClient(deploymentURL, token) ? : return
70
70
val workspace = restClient.workspaces().matchName(workspaceName, deploymentURL) ? : return
@@ -128,7 +128,7 @@ open class CoderProtocolHandler(
128
128
return workspace
129
129
}
130
130
131
- private suspend fun buildRestClient (deploymentURL : String , token : String ): CoderRestClient ? {
131
+ private suspend fun buildRestClient (deploymentURL : String , token : String? ): CoderRestClient ? {
132
132
try {
133
133
return authenticate(deploymentURL, token)
134
134
} catch (ex: Exception ) {
@@ -140,11 +140,11 @@ open class CoderProtocolHandler(
140
140
/* *
141
141
* Returns an authenticated Coder CLI.
142
142
*/
143
- private suspend fun authenticate (deploymentURL : String , token : String ): CoderRestClient {
143
+ private suspend fun authenticate (deploymentURL : String , token : String? ): CoderRestClient {
144
144
val client = CoderRestClient (
145
145
context,
146
146
deploymentURL.toURL(),
147
- if (settings.requireTokenAuth) token else null ,
147
+ token,
148
148
PluginManager .pluginInfo.version
149
149
)
150
150
client.initializeSession()
0 commit comments