Skip to content

Commit e3e4838

Browse files
Merge branch 'main' into samgst/emitAuthScopesInUserState
2 parents 214f4d8 + c765d61 commit e3e4838

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/DiskCache.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import software.aws.toolkits.core.utils.touch
3232
import software.aws.toolkits.core.utils.tryDirOp
3333
import software.aws.toolkits.core.utils.tryFileOp
3434
import software.aws.toolkits.core.utils.tryOrNull
35+
import software.aws.toolkits.core.utils.warn
3536
import software.aws.toolkits.telemetry.AuthTelemetry
3637
import software.aws.toolkits.telemetry.Result
3738
import java.io.InputStream
@@ -105,7 +106,7 @@ class DiskCache(
105106
val inputStream = clientRegistrationCache(cacheKey).tryInputStreamIfExists()
106107
if (inputStream == null) {
107108
val stage = LoadCredentialStage.ACCESS_FILE
108-
LOG.warn("Failed to load Client Registration: cache file does not exist")
109+
LOG.warn { "Failed to load Client Registration: cache file does not exist" }
109110
AuthTelemetry.modifyConnection(
110111
action = "Load cache file",
111112
source = "loadClientRegistration",
@@ -224,7 +225,7 @@ class DiskCache(
224225
if (clientRegistration.expiresAt.isNotExpired()) {
225226
return clientRegistration
226227
} else {
227-
LOG.warn("Client Registration is expired")
228+
LOG.warn { "Client Registration is expired" }
228229
AuthTelemetry.modifyConnection(
229230
action = "Validate Credentials",
230231
source = "loadClientRegistration",
@@ -235,7 +236,7 @@ class DiskCache(
235236
return null
236237
}
237238
} catch (e: Exception) {
238-
LOG.warn("Client Registration could not be read")
239+
LOG.warn { "Client Registration could not be read" }
239240
AuthTelemetry.modifyConnection(
240241
action = "Validate Credentials",
241242
source = "loadClientRegistration",

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/SsoAccessTokenProvider.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class SsoAccessTokenProvider(
176176
result = Result.Succeeded
177177
)
178178
} catch (e: Exception) {
179-
getLogger<SsoAccessTokenProvider>().warn("Failed to save access token ${e.message}")
179+
LOG.warn { "Failed to save access token ${e.message}" }
180180
AuthTelemetry.modifyConnection(
181181
action = "Write file",
182182
source = "accessToken",
@@ -218,7 +218,7 @@ class SsoAccessTokenProvider(
218218
result = Result.Succeeded
219219
)
220220
} catch (e: Exception) {
221-
getLogger<SsoAccessTokenProvider>().warn("Failed to save client registration ${e.message}")
221+
LOG.warn { "Failed to save client registration ${e.message}" }
222222
AuthTelemetry.modifyConnection(
223223
action = "Write file",
224224
source = "registerDAGClient",
@@ -238,7 +238,7 @@ class SsoAccessTokenProvider(
238238
}
239239

240240
if (!ssoUrl.contains("identitycenter")) {
241-
getLogger<SsoAccessTokenProvider>().warn { "$ssoUrl does not appear to be a valid issuer URL" }
241+
LOG.warn { "$ssoUrl does not appear to be a valid issuer URL" }
242242
}
243243

244244
val registerResponse = client.registerClient {
@@ -270,7 +270,7 @@ class SsoAccessTokenProvider(
270270
result = Result.Succeeded
271271
)
272272
} catch (e: Exception) {
273-
getLogger<SsoAccessTokenProvider>().warn("Failed to save client registration${e.message}")
273+
LOG.warn { "Failed to save client registration${e.message}" }
274274
AuthTelemetry.modifyConnection(
275275
action = "Write file",
276276
source = "registerPkceClient",
@@ -498,7 +498,7 @@ class SsoAccessTokenProvider(
498498
requestId = requestId,
499499
result = Result.Failed
500500
)
501-
getLogger<SsoAccessTokenProvider>().warn("RefreshAccessTokenFailed: ${e.message}")
501+
LOG.warn { "RefreshAccessTokenFailed: ${e.message}" }
502502
throw e
503503
}
504504
}
@@ -577,5 +577,6 @@ class SsoAccessTokenProvider(
577577
// Default number of seconds to poll for token, https://tools.ietf.org/html/draft-ietf-oauth-device-flow-15#section-3.5
578578
const val DEFAULT_INTERVAL_SECS = 5L
579579
const val SLOW_DOWN_DELAY_SECS = 5L
580+
private val LOG = getLogger<SsoAccessTokenProvider>()
580581
}
581582
}

0 commit comments

Comments
 (0)