From ce982be5b7056e33e6738936e1bc668a9b8ab656 Mon Sep 17 00:00:00 2001 From: Jackson Tian Date: Tue, 23 Jul 2024 23:22:09 +0800 Subject: [PATCH] Add useragent for OIDC assume role --- .../main/java/com/aliyuncs/auth/OIDCCredentialsProvider.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aliyun-java-sdk-core/src/main/java/com/aliyuncs/auth/OIDCCredentialsProvider.java b/aliyun-java-sdk-core/src/main/java/com/aliyuncs/auth/OIDCCredentialsProvider.java index 6b8438a38e..7ba4584762 100644 --- a/aliyun-java-sdk-core/src/main/java/com/aliyuncs/auth/OIDCCredentialsProvider.java +++ b/aliyun-java-sdk-core/src/main/java/com/aliyuncs/auth/OIDCCredentialsProvider.java @@ -16,6 +16,7 @@ import com.aliyuncs.http.HttpRequest; import com.aliyuncs.http.HttpResponse; import com.aliyuncs.http.MethodType; +import com.aliyuncs.http.UserAgentConfig; import com.aliyuncs.http.clients.CompatibleUrlConnClient; import com.aliyuncs.utils.AuthUtils; import com.aliyuncs.utils.ParameterHelper; @@ -148,6 +149,7 @@ private String invokeAssumeRoleWithOIDC() throws ClientException { httpRequest.setHttpContentType(FormatType.FORM); httpRequest.setSysConnectTimeout(1000); httpRequest.setSysReadTimeout(3000); + httpRequest.putHeaderParameter("UserAgent", UserAgentConfig.resolve(null, null)); String oidcToken = AuthUtils.readFile(oidcTokenFilePath); if (oidcToken == null) { throw new ClientException("Read OIDC token failed");