AWS SDK for C++  1.9.16
AWS SDK for C++
STSAssumeRoleCredentialsProvider.h
Go to the documentation of this file.
1 
6 #pragma once
7 
10 
11 #include <memory>
12 #include <mutex>
13 #include <atomic>
14 
15 namespace Aws
16 {
17  namespace STS
18  {
19  class STSClient;
20  }
21 
22  namespace Auth
23  {
27  static const int DEFAULT_CREDS_LOAD_FREQ_SECONDS = 900;
28 
33  {
34  public:
47  STSAssumeRoleCredentialsProvider(const Aws::String& roleArn, const Aws::String& sessionName = Aws::String(),
48  const Aws::String& externalId = Aws::String(), int loadFrequency = DEFAULT_CREDS_LOAD_FREQ_SECONDS,
49  const std::shared_ptr<Aws::STS::STSClient>& stsClient = nullptr);
50 
52 
53  private:
54  void LoadCredentialsFromSTS();
55 
56  std::shared_ptr<Aws::STS::STSClient> m_stsClient;
57  AWSCredentials m_cachedCredentials;
58  Aws::String m_roleArn;
59  Aws::String m_sessionName;
60  Aws::String m_externalId;
61  std::atomic<int64_t> m_expiry;
62  std::mutex m_credsMutex;
63  std::atomic<int> m_loadFrequency;
64  };
65  }
66 }
Aws::Auth::STSAssumeRoleCredentialsProvider::STSAssumeRoleCredentialsProvider
STSAssumeRoleCredentialsProvider(const Aws::String &roleArn, const Aws::String &sessionName=Aws::String(), const Aws::String &externalId=Aws::String(), int loadFrequency=DEFAULT_CREDS_LOAD_FREQ_SECONDS, const std::shared_ptr< Aws::STS::STSClient > &stsClient=nullptr)
AWS_IDENTITY_MANAGEMENT_API
#define AWS_IDENTITY_MANAGEMENT_API
Definition: IdentityManagment_EXPORTS.h:23
Aws::Auth::DEFAULT_CREDS_LOAD_FREQ_SECONDS
static const int DEFAULT_CREDS_LOAD_FREQ_SECONDS
Definition: STSAssumeRoleCredentialsProvider.h:27
Aws::Auth::AWSCredentialsProvider
Definition: AWSCredentialsProvider.h:51
Aws::Auth::AWSCredentials
Definition: AWSCredentials.h:19
Aws::Auth::STSAssumeRoleCredentialsProvider::GetAWSCredentials
AWSCredentials GetAWSCredentials() override
Aws::Auth::STSAssumeRoleCredentialsProvider
Definition: STSAssumeRoleCredentialsProvider.h:33
AWSCredentialsProvider.h
Aws
Definition: AccessManagementClient.h:15
Aws::String
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition: AWSString.h:97
Aws::STS::STSClient
Definition: STSClient.h:117
IdentityManagment_EXPORTS.h