Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: supplement fields in cli and profile credentials #48

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

PanPanZou
Copy link
Collaborator

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 11 lines in your changes missing coverage. Please review.

Project coverage is 95.37%. Comparing base (9209a2a) to head (6e48607).

Files with missing lines Patch % Lines
...dentials/Provider/CLIProfileCredentialsProvider.cs 90.00% 3 Missing ⚠️
...dentials/Provider/OIDCRoleArnCredentialProvider.cs 57.14% 2 Missing and 1 partial ⚠️
...edentials/Provider/RamRoleArnCredentialProvider.cs 57.14% 2 Missing and 1 partial ⚠️
aliyun-net-credentials/Utils/AuthUtils.cs 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #48      +/-   ##
==========================================
+ Coverage   94.97%   95.37%   +0.40%     
==========================================
  Files          66       66              
  Lines        5391     5454      +63     
  Branches      231      234       +3     
==========================================
+ Hits         5120     5202      +82     
+ Misses        223      204      -19     
  Partials       48       48              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -19,7 +19,7 @@ namespace Aliyun.Credentials.Provider
/// <item><description>Windows: C:\Users\USER_NAME\.aliyun\config.json</description></item>
/// </list>
/// </summary>
internal class CLIProfileCredentialsProvider : IAlibabaCloudCredentialsProvider
public class CLIProfileCredentialsProvider : IAlibabaCloudCredentialsProvider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不能改成public,不然中途被外界改了

@@ -158,6 +165,9 @@ internal IAlibabaCloudCredentialsProvider ReloadCredentialsProvider(Config confi
.RoleSessionName(profile.GetRoleSessionName())
.OIDCProviderArn(profile.GetOidcProviderArn())
.OIDCTokenFilePath(profile.GetOidcTokenFile())
.StsRegionId(profile.GetStsRegionId())
.Policy(profile.GetPolicy())
.EnableVpc(profile.GetEnableVpc() ?? false)
.Build();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不能带默认值false,为空的话,需要根据环境变量ALIBABA_CLOUD_ENABLE_VPC_ENDPOINT来判断

@@ -166,6 +176,10 @@ internal IAlibabaCloudCredentialsProvider ReloadCredentialsProvider(Config confi
.RoleArn(profile.GetRoleArn())
.DurationSeconds(profile.GetDurationSeconds() ?? 3600)
.RoleSessionName(profile.GetRoleSessionName())
.StsRegionId(profile.GetStsRegionId())
.EnableVpc(profile.GetEnableVpc() ?? false)
.Policy(profile.GetPolicy())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@@ -172,6 +175,9 @@ public CredentialModel GetSTSAssumeRoleSessionCredentials(Dictionary<string, str
.RoleArn(roleArn)
.RegionId(regionId)
.Policy(policy)
.StsRegionId(stsRegionId)
.EnableVpc(enableVpc == "true")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enableVpc如果为空,这里是不是就设置成false了

@@ -323,6 +331,8 @@ public async Task<CredentialModel> GetSTSOIDCRoleSessionCredentialsAsync(Diction
.RoleSessionName(roleSessionName)
.RegionId(regionId)
.Policy(policy)
.StsRegionId(stsRegionId)
.EnableVpc(enableVpc == "true")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@PanPanZou PanPanZou force-pushed the file-credentials branch 9 times, most recently from 537ae90 to 9b3e148 Compare November 5, 2024 04:12
@yndu13 yndu13 merged commit 7df2aa2 into master Nov 5, 2024
2 checks passed
@yndu13 yndu13 deleted the file-credentials branch November 5, 2024 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants