Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import software.aws.toolkits.core.utils.touch
import software.aws.toolkits.core.utils.tryDirOp
import software.aws.toolkits.core.utils.tryFileOp
import software.aws.toolkits.core.utils.tryOrNull
import software.aws.toolkits.core.utils.warn
import software.aws.toolkits.telemetry.AuthTelemetry
import software.aws.toolkits.telemetry.Result
import java.io.InputStream
Expand Down Expand Up @@ -105,7 +106,7 @@ class DiskCache(
val inputStream = clientRegistrationCache(cacheKey).tryInputStreamIfExists()
if (inputStream == null) {
val stage = LoadCredentialStage.ACCESS_FILE
LOG.warn("Failed to load Client Registration: cache file does not exist")
LOG.warn { "Failed to load Client Registration: cache file does not exist" }
AuthTelemetry.modifyConnection(
action = "Load cache file",
source = "loadClientRegistration",
Expand Down Expand Up @@ -224,7 +225,7 @@ class DiskCache(
if (clientRegistration.expiresAt.isNotExpired()) {
return clientRegistration
} else {
LOG.warn("Client Registration is expired")
LOG.warn { "Client Registration is expired" }
AuthTelemetry.modifyConnection(
action = "Validate Credentials",
source = "loadClientRegistration",
Expand All @@ -235,7 +236,7 @@ class DiskCache(
return null
}
} catch (e: Exception) {
LOG.warn("Client Registration could not be read")
LOG.warn { "Client Registration could not be read" }
AuthTelemetry.modifyConnection(
action = "Validate Credentials",
source = "loadClientRegistration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
result = Result.Succeeded
)
} catch (e: Exception) {
getLogger<SsoAccessTokenProvider>().warn("Failed to save access token ${e.message}")
LOG.warn { "Failed to save access token ${e.message}" }

Check warning on line 179 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/SsoAccessTokenProvider.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L179 was not covered by tests
AuthTelemetry.modifyConnection(
action = "Write file",
source = "accessToken",
Expand Down Expand Up @@ -218,7 +218,7 @@
result = Result.Succeeded
)
} catch (e: Exception) {
getLogger<SsoAccessTokenProvider>().warn("Failed to save client registration ${e.message}")
LOG.warn { "Failed to save client registration ${e.message}" }

Check warning on line 221 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/SsoAccessTokenProvider.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L221 was not covered by tests
AuthTelemetry.modifyConnection(
action = "Write file",
source = "registerDAGClient",
Expand All @@ -238,7 +238,7 @@
}

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

val registerResponse = client.registerClient {
Expand Down Expand Up @@ -270,7 +270,7 @@
result = Result.Succeeded
)
} catch (e: Exception) {
getLogger<SsoAccessTokenProvider>().warn("Failed to save client registration${e.message}")
LOG.warn { "Failed to save client registration${e.message}" }

Check warning on line 273 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/SsoAccessTokenProvider.kt

View check run for this annotation

Codecov / codecov/patch

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

Added line #L273 was not covered by tests
AuthTelemetry.modifyConnection(
action = "Write file",
source = "registerPkceClient",
Expand Down Expand Up @@ -498,7 +498,7 @@
requestId = requestId,
result = Result.Failed
)
getLogger<SsoAccessTokenProvider>().warn("RefreshAccessTokenFailed: ${e.message}")
LOG.warn { "RefreshAccessTokenFailed: ${e.message}" }
throw e
}
}
Expand Down Expand Up @@ -577,5 +577,6 @@
// Default number of seconds to poll for token, https://tools.ietf.org/html/draft-ietf-oauth-device-flow-15#section-3.5
const val DEFAULT_INTERVAL_SECS = 5L
const val SLOW_DOWN_DELAY_SECS = 5L
private val LOG = getLogger<SsoAccessTokenProvider>()
}
}
Loading