Public AssumeRole AssumeRoleWithSAML AssumeRoleWithOIDC for supporting sourceIdentity.
This commit is contained in:
@@ -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_;
|
||||||
|
|||||||
@@ -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_;
|
||||||
|
|
||||||
|
|||||||
@@ -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_;
|
||||||
|
|||||||
@@ -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_;
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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_;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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_;
|
||||||
|
|||||||
@@ -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_;
|
||||||
|
|||||||
@@ -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_;
|
||||||
|
|||||||
Reference in New Issue
Block a user