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

@@ -31,21 +31,21 @@ StsClient::StsClient(const Credentials &credentials, const ClientConfiguration &
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(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) :
RpcServiceClient(SERVICE_NAME, 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) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(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()

View File

@@ -34,6 +34,15 @@ void AssumeRoleRequest::setExternalId(const std::string &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 {
return roleSessionName_;
}

View File

@@ -53,9 +53,16 @@ void AssumeRoleResult::parse(const std::string &payload)
credentials_.accessKeySecret = credentialsNode["AccessKeySecret"].asString();
if(!credentialsNode["AccessKeyId"].isNull())
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
{
return assumedRoleUser_;

View File

@@ -66,9 +66,16 @@ void AssumeRoleWithOIDCResult::parse(const std::string &payload)
credentials_.accessKeySecret = credentialsNode["AccessKeySecret"].asString();
if(!credentialsNode["AccessKeyId"].isNull())
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
{
return oIDCTokenInfo_;

View File

@@ -62,9 +62,16 @@ void AssumeRoleWithSAMLResult::parse(const std::string &payload)
credentials_.accessKeySecret = credentialsNode["AccessKeySecret"].asString();
if(!credentialsNode["AccessKeyId"].isNull())
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
{
return sAMLAssertionInfo_;