1#ifndef _DITTO_IDENTITY_
2#define _DITTO_IDENTITY_
4#include "AuthenticationCallback.hpp"
21enum class IdentityType {
23 ONLINE_WITH_AUTHENTICATION,
32std::string default_auth_url(std::string app_id);
57 friend class ManualIdentity;
58 friend class OfflinePlaygroundIdentity;
59 friend class OnlineWithAuthenticationIdentity;
60 friend class OnlinePlaygroundIdentity;
61 friend class SharedKeyIdentity;
62 friend class TransportSync;
79 static std::shared_ptr<OfflinePlaygroundIdentity>
93 static std::shared_ptr<OnlineWithAuthenticationIdentity>
95 std::shared_ptr<AuthenticationCallback> callback,
96 bool enable_ditto_cloud_sync =
true,
97 std::string custom_auth_url =
"");
112 static std::shared_ptr<OnlinePlaygroundIdentity>
114 bool enable_ditto_cloud_sync =
true);
126 static std::shared_ptr<SharedKeyIdentity>
127 SharedKey(std::string app_id, std::string shared_key, uint64_t site_id = 0);
135 static std::shared_ptr<ManualIdentity>
Manual(std::string certificate_config);
138 virtual std::string get_app_id()
const;
139 virtual bool get_enable_ditto_cloud_sync()
const;
140 virtual bool requires_offline_license_token()
const;
145 virtual CIdentityConfig_t *build_identity_config() = 0;
153class OfflinePlaygroundIdentity :
public Identity {
154 friend class Identity;
163 OfflinePlaygroundIdentity(std::string app_id, uint64_t
site_id);
166 std::string get_app_id()
const;
167 bool requires_offline_license_token()
const;
168 CIdentityConfig_t *build_identity_config();
191class OnlineWithAuthenticationIdentity :
public Identity {
193 friend class Identity;
208 OnlineWithAuthenticationIdentity(
209 std::string app_id, std::shared_ptr<AuthenticationCallback> callback,
213 std::shared_ptr<AuthenticationCallback> callback;
214 std::string get_app_id()
const;
215 bool get_enable_ditto_cloud_sync()
const;
216 bool requires_offline_license_token()
const;
217 CIdentityConfig_t *build_identity_config();
225class OnlinePlaygroundIdentity :
public Identity {
226 friend class Identity;
241 OnlinePlaygroundIdentity(std::string app_id, std::string
token,
245 std::string get_app_id()
const;
246 std::string get_token()
const;
247 bool get_enable_ditto_cloud_sync()
const;
248 bool requires_offline_license_token()
const;
249 CIdentityConfig_t *build_identity_config();
258class SharedKeyIdentity :
public Identity {
259 friend class Identity;
273 SharedKeyIdentity(std::string app_id, std::string
shared_key,
277 std::string get_app_id()
const;
278 bool requires_offline_license_token()
const;
279 CIdentityConfig_t *build_identity_config();
286class ManualIdentity :
public Identity {
287 friend class Identity;
298 bool requires_offline_license_token()
const;
299 CIdentityConfig_t *build_identity_config();
The various identity configurations that you can use when initializing a Ditto instance.
Definition Identity.hpp:55
static std::shared_ptr< OnlinePlaygroundIdentity > OnlinePlayground(std::string app_id, std::string token, bool enable_ditto_cloud_sync=true)
Construct a new OnlinePlaygroundIdentity.
Definition Identity.cpp:40
static std::shared_ptr< OfflinePlaygroundIdentity > OfflinePlayground(std::string app_id="", uint64_t site_id=0)
Construct a new OfflinePlaygroundIdentity.
Definition Identity.cpp:25
static std::shared_ptr< SharedKeyIdentity > SharedKey(std::string app_id, std::string shared_key, uint64_t site_id=0)
Construct a new SharedKeyIdentity.
Definition Identity.cpp:47
static std::shared_ptr< OnlineWithAuthenticationIdentity > OnlineWithAuthentication(std::string app_id, std::shared_ptr< AuthenticationCallback > callback, bool enable_ditto_cloud_sync=true, std::string custom_auth_url="")
Construct a new OnlineWithAuthenticationIdentity.
Definition Identity.cpp:31
static std::shared_ptr< ManualIdentity > Manual(std::string certificate_config)
Construct a new ManualIdentity.
Definition Identity.cpp:54
A manually-provided certificate identity. This accepts a base64-encoded bundle.
Definition Identity.hpp:286
std::string certificate_config
Definition Identity.hpp:294
Develop peer-to-peer apps with no cloud connection. This mode offers no security and must only be use...
Definition Identity.hpp:153
uint64_t site_id
Definition Identity.hpp:160
Test a Ditto Cloud app with weak shared token authentication ("Playground mode"). This is not secure ...
Definition Identity.hpp:225
std::string token
Definition Identity.hpp:233
bool enable_ditto_cloud_sync
Definition Identity.hpp:238
Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication serve...
Definition Identity.hpp:191
std::string custom_auth_url
Definition Identity.hpp:205
bool enable_ditto_cloud_sync
Definition Identity.hpp:199
A mode where any device is trusted provided they know the secret key. This is a simplistic authentica...
Definition Identity.hpp:258
std::string shared_key
Definition Identity.hpp:265
uint64_t site_id
Definition Identity.hpp:270