Public AssumeRole AssumeRoleWithSAML AssumeRoleWithOIDC for supporting sourceIdentity.

This commit is contained in:
sdk-team
2025-06-30 09:13:38 +00:00
parent ee32114ccc
commit 88f17da9be
10 changed files with 43 additions and 4 deletions

View File

@@ -1 +1 @@
1.36.2078 1.36.2079

View File

@@ -32,6 +32,8 @@ public:
~AssumeRoleRequest(); ~AssumeRoleRequest();
std::string getExternalId() const; std::string getExternalId() const;
void setExternalId(const std::string &externalId); void setExternalId(const std::string &externalId);
std::string getSourceIdentity() const;
void setSourceIdentity(const std::string &sourceIdentity);
std::string getRoleSessionName() const; std::string getRoleSessionName() const;
void setRoleSessionName(const std::string &roleSessionName); void setRoleSessionName(const std::string &roleSessionName);
std::string getPolicy() const; std::string getPolicy() const;
@@ -43,6 +45,7 @@ public:
private: private:
std::string externalId_; std::string externalId_;
std::string sourceIdentity_;
std::string roleSessionName_; std::string roleSessionName_;
std::string policy_; std::string policy_;
std::string roleArn_; std::string roleArn_;

View File

@@ -49,12 +49,14 @@ namespace AlibabaCloud
AssumeRoleResult(); AssumeRoleResult();
explicit AssumeRoleResult(const std::string &payload); explicit AssumeRoleResult(const std::string &payload);
~AssumeRoleResult(); ~AssumeRoleResult();
std::string getSourceIdentity()const;
AssumedRoleUser getAssumedRoleUser()const; AssumedRoleUser getAssumedRoleUser()const;
Credentials getCredentials()const; Credentials getCredentials()const;
protected: protected:
void parse(const std::string &payload); void parse(const std::string &payload);
private: private:
std::string sourceIdentity_;
AssumedRoleUser assumedRoleUser_; AssumedRoleUser assumedRoleUser_;
Credentials credentials_; Credentials credentials_;

View File

@@ -58,6 +58,7 @@ namespace AlibabaCloud
AssumeRoleWithOIDCResult(); AssumeRoleWithOIDCResult();
explicit AssumeRoleWithOIDCResult(const std::string &payload); explicit AssumeRoleWithOIDCResult(const std::string &payload);
~AssumeRoleWithOIDCResult(); ~AssumeRoleWithOIDCResult();
std::string getSourceIdentity()const;
OIDCTokenInfo getOIDCTokenInfo()const; OIDCTokenInfo getOIDCTokenInfo()const;
AssumedRoleUser getAssumedRoleUser()const; AssumedRoleUser getAssumedRoleUser()const;
Credentials getCredentials()const; Credentials getCredentials()const;
@@ -65,6 +66,7 @@ namespace AlibabaCloud
protected: protected:
void parse(const std::string &payload); void parse(const std::string &payload);
private: private:
std::string sourceIdentity_;
OIDCTokenInfo oIDCTokenInfo_; OIDCTokenInfo oIDCTokenInfo_;
AssumedRoleUser assumedRoleUser_; AssumedRoleUser assumedRoleUser_;
Credentials credentials_; Credentials credentials_;

View File

@@ -56,6 +56,7 @@ namespace AlibabaCloud
AssumeRoleWithSAMLResult(); AssumeRoleWithSAMLResult();
explicit AssumeRoleWithSAMLResult(const std::string &payload); explicit AssumeRoleWithSAMLResult(const std::string &payload);
~AssumeRoleWithSAMLResult(); ~AssumeRoleWithSAMLResult();
std::string getSourceIdentity()const;
SAMLAssertionInfo getSAMLAssertionInfo()const; SAMLAssertionInfo getSAMLAssertionInfo()const;
AssumedRoleUser getAssumedRoleUser()const; AssumedRoleUser getAssumedRoleUser()const;
Credentials getCredentials()const; Credentials getCredentials()const;
@@ -63,6 +64,7 @@ namespace AlibabaCloud
protected: protected:
void parse(const std::string &payload); void parse(const std::string &payload);
private: private:
std::string sourceIdentity_;
SAMLAssertionInfo sAMLAssertionInfo_; SAMLAssertionInfo sAMLAssertionInfo_;
AssumedRoleUser assumedRoleUser_; AssumedRoleUser assumedRoleUser_;
Credentials credentials_; Credentials credentials_;

View File

@@ -31,21 +31,21 @@ StsClient::StsClient(const Credentials &credentials, const ClientConfiguration &
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration) RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
{ {
auto locationClient = std::make_shared<LocationClient>(credentials, configuration); auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, ""); endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "sts");
} }
StsClient::StsClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) : StsClient::StsClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{ {
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration); auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, ""); endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "sts");
} }
StsClient::StsClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : StsClient::StsClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration) RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{ {
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration); auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, ""); endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "sts");
} }
StsClient::~StsClient() StsClient::~StsClient()

View File

@@ -34,6 +34,15 @@ void AssumeRoleRequest::setExternalId(const std::string &externalId) {
setParameter(std::string("ExternalId"), externalId); setParameter(std::string("ExternalId"), externalId);
} }
std::string AssumeRoleRequest::getSourceIdentity() const {
return sourceIdentity_;
}
void AssumeRoleRequest::setSourceIdentity(const std::string &sourceIdentity) {
sourceIdentity_ = sourceIdentity;
setParameter(std::string("SourceIdentity"), sourceIdentity);
}
std::string AssumeRoleRequest::getRoleSessionName() const { std::string AssumeRoleRequest::getRoleSessionName() const {
return roleSessionName_; return roleSessionName_;
} }

View File

@@ -53,9 +53,16 @@ void AssumeRoleResult::parse(const std::string &payload)
credentials_.accessKeySecret = credentialsNode["AccessKeySecret"].asString(); credentials_.accessKeySecret = credentialsNode["AccessKeySecret"].asString();
if(!credentialsNode["AccessKeyId"].isNull()) if(!credentialsNode["AccessKeyId"].isNull())
credentials_.accessKeyId = credentialsNode["AccessKeyId"].asString(); credentials_.accessKeyId = credentialsNode["AccessKeyId"].asString();
if(!value["SourceIdentity"].isNull())
sourceIdentity_ = value["SourceIdentity"].asString();
} }
std::string AssumeRoleResult::getSourceIdentity()const
{
return sourceIdentity_;
}
AssumeRoleResult::AssumedRoleUser AssumeRoleResult::getAssumedRoleUser()const AssumeRoleResult::AssumedRoleUser AssumeRoleResult::getAssumedRoleUser()const
{ {
return assumedRoleUser_; return assumedRoleUser_;

View File

@@ -66,9 +66,16 @@ void AssumeRoleWithOIDCResult::parse(const std::string &payload)
credentials_.accessKeySecret = credentialsNode["AccessKeySecret"].asString(); credentials_.accessKeySecret = credentialsNode["AccessKeySecret"].asString();
if(!credentialsNode["AccessKeyId"].isNull()) if(!credentialsNode["AccessKeyId"].isNull())
credentials_.accessKeyId = credentialsNode["AccessKeyId"].asString(); credentials_.accessKeyId = credentialsNode["AccessKeyId"].asString();
if(!value["SourceIdentity"].isNull())
sourceIdentity_ = value["SourceIdentity"].asString();
} }
std::string AssumeRoleWithOIDCResult::getSourceIdentity()const
{
return sourceIdentity_;
}
AssumeRoleWithOIDCResult::OIDCTokenInfo AssumeRoleWithOIDCResult::getOIDCTokenInfo()const AssumeRoleWithOIDCResult::OIDCTokenInfo AssumeRoleWithOIDCResult::getOIDCTokenInfo()const
{ {
return oIDCTokenInfo_; return oIDCTokenInfo_;

View File

@@ -62,9 +62,16 @@ void AssumeRoleWithSAMLResult::parse(const std::string &payload)
credentials_.accessKeySecret = credentialsNode["AccessKeySecret"].asString(); credentials_.accessKeySecret = credentialsNode["AccessKeySecret"].asString();
if(!credentialsNode["AccessKeyId"].isNull()) if(!credentialsNode["AccessKeyId"].isNull())
credentials_.accessKeyId = credentialsNode["AccessKeyId"].asString(); credentials_.accessKeyId = credentialsNode["AccessKeyId"].asString();
if(!value["SourceIdentity"].isNull())
sourceIdentity_ = value["SourceIdentity"].asString();
} }
std::string AssumeRoleWithSAMLResult::getSourceIdentity()const
{
return sourceIdentity_;
}
AssumeRoleWithSAMLResult::SAMLAssertionInfo AssumeRoleWithSAMLResult::getSAMLAssertionInfo()const AssumeRoleWithSAMLResult::SAMLAssertionInfo AssumeRoleWithSAMLResult::getSAMLAssertionInfo()const
{ {
return sAMLAssertionInfo_; return sAMLAssertionInfo_;