You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/imds/TokenMiddleware.kt
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -66,8 +66,8 @@ internal class TokenMiddleware(
66
66
returntry {
67
67
when (call.response.status) {
68
68
HttpStatusCode.OK-> {
69
-
val ttl = call.response.headers[X_AWS_EC2_METADATA_TOKEN_TTL_SECONDS]?.toLong() ?:throwEC2MetadataError(200, "No TTL provided in IMDS response")
70
-
val token = call.response.body.readAll() ?:throwEC2MetadataError(200, "No token provided in IMDS response")
69
+
val ttl = call.response.headers[X_AWS_EC2_METADATA_TOKEN_TTL_SECONDS]?.toLong() ?:throwEC2MetadataError(call.response.status, "No TTL provided in IMDS response")
70
+
val token = call.response.body.readAll() ?:throwEC2MetadataError(call.response.status, "No token provided in IMDS response")
71
71
val expires = clock.now() + ttl.seconds
72
72
Token(token, expires)
73
73
}
@@ -76,7 +76,7 @@ internal class TokenMiddleware(
76
76
HttpStatusCode.Forbidden->"Request forbidden: IMDS is disabled or the caller has insufficient permissions."
0 commit comments