AWS SDK for C++  1.9.16
AWS SDK for C++
PersistentCognitoIdentityProvider.h
Go to the documentation of this file.
1 
5 #pragma once
6 
10 #include <mutex>
11 
12 namespace Aws
13 {
14  namespace Utils
15  {
16  namespace Json
17  {
18  class JsonView;
19  class JsonValue;
20  }
21  }
22  namespace Auth
23  {
25  {
30  };
31 
33  {
34  public:
36  virtual bool HasIdentityId() const = 0;
37  virtual bool HasLogins() const = 0;
38  virtual Aws::String GetIdentityId() const = 0;
40  virtual Aws::String GetAccountId() const = 0;
41  virtual Aws::String GetIdentityPoolId() const = 0;
42  virtual void PersistIdentityId(const Aws::String&) = 0;
44  inline void ClearLogins() { PersistLogins(Aws::Map<Aws::String, LoginAccessTokens>()); }
45  inline void ClearIdentity() { PersistIdentityId(""); }
46  inline void Logout() { ClearIdentity(); ClearLogins(); }
47 
48  inline void SetLoginsUpdatedCallback(const std::function<void(const PersistentCognitoIdentityProvider&)>& callback)
49  {
50  m_loginsUpdatedCallback = callback;
51  }
52 
53  inline void SetIdentityIdUpdatedCallback(const std::function<void(const PersistentCognitoIdentityProvider&)>& callback)
54  {
55  m_identityIdUpdatedCallback = callback;
56  }
57 
58  protected:
61  };
62 
64  {
65  public:
66  PersistentCognitoIdentityProvider_JsonFileImpl(const Aws::String& identityPoolId, const Aws::String& accountId, bool disableCaching = false);
67  PersistentCognitoIdentityProvider_JsonFileImpl(const Aws::String& identityPoolId, const Aws::String& accountId, const char* identitiesFilePath, bool disableCaching = false);
68 
69  bool HasIdentityId() const override;
70  bool HasLogins() const override;
71  Aws::String GetIdentityId() const override;
73  Aws::String GetAccountId() const override { return m_accountId; }
74  Aws::String GetIdentityPoolId() const override { return m_identityPoolId; }
75  void PersistIdentityId(const Aws::String&) override;
77 
78  private:
79  Utils::Json::JsonValue LoadJsonDocFromFile() const;
80  void PersistChangesToFile(const Utils::Json::JsonValue&) const;
81  void LoadAndParseDoc();
82 
84 
85  std::mutex m_docMutex;
86  Aws::String m_identityPoolId;
87  Aws::String m_accountId;
88  Aws::String m_identityId;
90  Aws::String m_identityFilePath;
91  bool m_disableCaching;
92  };
93 
95  }
96 }
Aws::Auth::PersistentCognitoIdentityProvider::m_loginsUpdatedCallback
std::function< void(const PersistentCognitoIdentityProvider &)> m_loginsUpdatedCallback
Definition: PersistentCognitoIdentityProvider.h:59
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl::HasIdentityId
bool HasIdentityId() const override
Aws::Auth::LoginAccessTokens::longTermTokenExpiry
long long longTermTokenExpiry
Definition: PersistentCognitoIdentityProvider.h:29
AWS_IDENTITY_MANAGEMENT_API
#define AWS_IDENTITY_MANAGEMENT_API
Definition: IdentityManagment_EXPORTS.h:23
Aws::Auth::PersistentCognitoIdentityProvider::GetAccountId
virtual Aws::String GetAccountId() const =0
Aws::Auth::PersistentCognitoIdentityProvider::PersistLogins
virtual void PersistLogins(const Aws::Map< Aws::String, LoginAccessTokens > &)=0
Aws::Auth::PersistentCognitoIdentityProvider::HasIdentityId
virtual bool HasIdentityId() const =0
Aws::Auth::PersistentCognitoIdentityProvider::ClearLogins
void ClearLogins()
Definition: PersistentCognitoIdentityProvider.h:44
Aws::Auth::PersistentCognitoIdentityProvider::GetIdentityId
virtual Aws::String GetIdentityId() const =0
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl::PersistentCognitoIdentityProvider_JsonFileImpl
PersistentCognitoIdentityProvider_JsonFileImpl(const Aws::String &identityPoolId, const Aws::String &accountId, bool disableCaching=false)
Aws::Auth::LoginAccessTokens::longTermToken
Aws::String longTermToken
Definition: PersistentCognitoIdentityProvider.h:28
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl::GetAccountId
Aws::String GetAccountId() const override
Definition: PersistentCognitoIdentityProvider.h:73
Aws::Auth::DefaultPersistentCognitoIdentityProvider
PersistentCognitoIdentityProvider_JsonFileImpl DefaultPersistentCognitoIdentityProvider
Definition: PersistentCognitoIdentityProvider.h:94
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl::HasLogins
bool HasLogins() const override
Aws::Auth::PersistentCognitoIdentityProvider::SetIdentityIdUpdatedCallback
void SetIdentityIdUpdatedCallback(const std::function< void(const PersistentCognitoIdentityProvider &)> &callback)
Definition: PersistentCognitoIdentityProvider.h:53
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl::GetLogins
Aws::Map< Aws::String, LoginAccessTokens > GetLogins() override
Aws::Auth::LoginAccessTokens::accessToken
Aws::String accessToken
Definition: PersistentCognitoIdentityProvider.h:27
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl::GetIdentityPoolId
Aws::String GetIdentityPoolId() const override
Definition: PersistentCognitoIdentityProvider.h:74
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl::PersistentCognitoIdentityProvider_JsonFileImpl
PersistentCognitoIdentityProvider_JsonFileImpl(const Aws::String &identityPoolId, const Aws::String &accountId, const char *identitiesFilePath, bool disableCaching=false)
Aws::Auth::PersistentCognitoIdentityProvider::GetLogins
virtual Aws::Map< Aws::String, LoginAccessTokens > GetLogins()=0
Aws::Auth::PersistentCognitoIdentityProvider
Definition: PersistentCognitoIdentityProvider.h:33
AWSString.h
Aws::Utils::Json::JsonValue
Definition: JsonSerializer.h:30
Aws::Auth::LoginAccessTokens
Definition: PersistentCognitoIdentityProvider.h:25
Aws::Auth::PersistentCognitoIdentityProvider::PersistIdentityId
virtual void PersistIdentityId(const Aws::String &)=0
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl::PersistLogins
void PersistLogins(const Aws::Map< Aws::String, LoginAccessTokens > &) override
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl::PersistIdentityId
void PersistIdentityId(const Aws::String &) override
Aws
Definition: AccessManagementClient.h:15
Aws::Auth::PersistentCognitoIdentityProvider::HasLogins
virtual bool HasLogins() const =0
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl::GetIdentityId
Aws::String GetIdentityId() const override
Aws::Auth::PersistentCognitoIdentityProvider::~PersistentCognitoIdentityProvider
virtual ~PersistentCognitoIdentityProvider()=default
Aws::String
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition: AWSString.h:97
Aws::Auth::PersistentCognitoIdentityProvider::GetIdentityPoolId
virtual Aws::String GetIdentityPoolId() const =0
Aws::Auth::PersistentCognitoIdentityProvider::m_identityIdUpdatedCallback
std::function< void(const PersistentCognitoIdentityProvider &)> m_identityIdUpdatedCallback
Definition: PersistentCognitoIdentityProvider.h:60
AWSMap.h
IdentityManagment_EXPORTS.h
Aws::Auth::LoginAccessTokens::LoginAccessTokens
LoginAccessTokens()
Definition: PersistentCognitoIdentityProvider.h:26
Aws::Auth::PersistentCognitoIdentityProvider::Logout
void Logout()
Definition: PersistentCognitoIdentityProvider.h:46
Aws::Auth::PersistentCognitoIdentityProvider_JsonFileImpl
Definition: PersistentCognitoIdentityProvider.h:64
Aws::Auth::PersistentCognitoIdentityProvider::SetLoginsUpdatedCallback
void SetLoginsUpdatedCallback(const std::function< void(const PersistentCognitoIdentityProvider &)> &callback)
Definition: PersistentCognitoIdentityProvider.h:48
Aws::Map
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
Definition: AWSMap.h:19
Aws::Auth::PersistentCognitoIdentityProvider::ClearIdentity
void ClearIdentity()
Definition: PersistentCognitoIdentityProvider.h:45