diff --git a/paws.common/R/credential_providers.R b/paws.common/R/credential_providers.R index e0bf68c8b..306f664cd 100644 --- a/paws.common/R/credential_providers.R +++ b/paws.common/R/credential_providers.R @@ -296,7 +296,8 @@ sso_credential_process <- function(sso_session, check_if_cred_needs_refresh <- function(sso_role_name){ if (!is.null(cred <- cred_refresh_cache[[sso_role_name]])) { - if (!length(expire <- cred$expiration)) expire <- 0 + expire <- cred$expiration + if (is.infinite(expire) | !length(expire)) expire <- 0 expiration <- expire / 1000 now <- as.numeric(Sys.time()) return(now > expiration) diff --git a/paws.common/tests/testthat/test_config.R b/paws.common/tests/testthat/test_config.R index 5e7da9045..fe9912efb 100644 --- a/paws.common/tests/testthat/test_config.R +++ b/paws.common/tests/testthat/test_config.R @@ -341,7 +341,7 @@ test_that("sso_credential_process legacy", { expiration = "foo_world" ) )) - mock_Creds <- mock2(TRUE) + mock_Creds <- mock2(Creds()) mock_sso <- mock2(list(get_role_credentials = mock_get_role_credentials)) mockery::stub(sso_credential_process, "file.exists", mock_file_exists) mockery::stub(sso_credential_process, "jsonlite::fromJSON", mock_fromJSON) @@ -386,7 +386,7 @@ test_that("sso_credential_process", { expiration = "foo_world" ) )) - mock_Creds <- mock2(TRUE) + mock_Creds <- mock2(Creds()) mock_sso <- mock2(list(get_role_credentials = mock_get_role_credentials)) mockery::stub(sso_credential_process, "file.exists", mock_file_exists) mockery::stub(sso_credential_process, "jsonlite::fromJSON", mock_fromJSON)