1#ifndef _DITTO_IDENTITY_
2#define _DITTO_IDENTITY_
4#include "AuthenticationCallback.hpp"
15class DevelopmentIdentity;
16class OfflinePlaygroundIdentity;
18class OnlineWithAuthenticationIdentity;
19class OnlinePlaygroundIdentity;
20class OnlinePlaygroundV2Identity;
21class SharedKeyIdentity;
27enum class IdentityType {
31 ONLINE_WITH_AUTHENTICATION,
95 static std::shared_ptr<DevelopmentIdentity>
96 Development(std::string app_id =
"", uint64_t site_id = 0,
97 std::string persistence_dir =
"");
112 static std::shared_ptr<OfflinePlaygroundIdentity>
114 std::string persistence_dir =
"");
131 static std::shared_ptr<OnlineIdentity>
132 Online(std::string app_id, std::shared_ptr<AuthenticationCallback> callback,
133 bool enable_ditto_cloud_sync =
true, std::string custom_auth_url =
"",
134 std::string persistence_dir =
"");
149 static std::shared_ptr<OnlineWithAuthenticationIdentity>
151 std::shared_ptr<AuthenticationCallback> callback,
152 bool enable_ditto_cloud_sync =
true,
153 std::string custom_auth_url =
"",
154 std::string persistence_dir =
"");
166 static std::shared_ptr<OnlinePlaygroundIdentity>
168 std::string persistence_dir =
"");
186 static std::shared_ptr<OnlinePlaygroundV2Identity>
188 bool enable_ditto_cloud_sync =
true,
189 std::string persistence_dir =
"");
203 static std::shared_ptr<SharedKeyIdentity>
204 SharedKey(std::string app_id, std::string shared_key, uint64_t site_id = 0,
205 std::string persistence_dir =
"");
213 static std::shared_ptr<ManualIdentity>
Manual(std::string certificate_config);
216 virtual std::string get_app_id()
const;
217 virtual std::shared_ptr<Authenticator> get_authenticator()
const;
218 virtual bool get_enable_ditto_cloud_sync()
const;
219 virtual bool requires_offline_license_token()
const;
220 std::shared_ptr<CAuthClient_t> auth_client;
246 std::string persistence_dir);
248 std::string get_app_id()
const;
249 bool requires_offline_license_token()
const;
273 std::string persistence_dir);
275 std::string get_app_id()
const;
276 bool requires_offline_license_token()
const;
323 std::shared_ptr<AuthenticationCallback> callback,
325 std::string persistence_dir);
327 std::string get_app_id()
const;
328 bool get_enable_ditto_cloud_sync()
const;
329 std::shared_ptr<Authenticator> get_authenticator();
330 std::shared_ptr<Authenticator> authenticator;
331 std::shared_ptr<LoginProvider> login_provider;
332 bool requires_offline_license_token()
const;
377 std::string
app_id, std::shared_ptr<AuthenticationCallback> callback,
379 std::string persistence_dir);
381 std::string get_app_id()
const;
382 bool get_enable_ditto_cloud_sync()
const;
383 std::shared_ptr<Authenticator> get_authenticator()
const;
384 std::shared_ptr<Authenticator> authenticator;
385 std::shared_ptr<LoginProvider> login_provider;
386 bool requires_offline_license_token()
const;
409 std::string persistence_dir);
411 std::string get_app_id()
const;
412 bool get_enable_ditto_cloud_sync()
const;
413 bool requires_offline_license_token()
const;
444 std::string persistence_dir);
446 std::string get_app_id()
const;
447 std::string get_token()
const;
448 bool get_enable_ditto_cloud_sync()
const;
449 bool requires_offline_license_token()
const;
450 std::shared_ptr<Authenticator> get_authenticator()
const;
451 std::shared_ptr<Authenticator> authenticator;
481 std::string persistence_dir);
483 std::string get_app_id()
const;
484 bool requires_offline_license_token()
const;
503 bool requires_offline_license_token()
const;
Develop peer-to-peer apps with no cloud connection. This mode offers no security and must only be use...
Definition: Identity.hpp:230
uint64_t site_id
Definition: Identity.hpp:242
std::string app_id
Definition: Identity.hpp:237
The entrypoint to the Ditto SDK.
Definition: Ditto.hpp:25
The various identity configurations that you can use when initializing a Ditto instance.
Definition: Identity.hpp:65
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="", std::string persistence_dir="")
Construct a new OnlineWithAuthenticationIdentity.
Definition: Identity.cpp:53
static std::shared_ptr< OnlinePlaygroundV2Identity > OnlinePlaygroundV2(std::string app_id, std::string token, bool enable_ditto_cloud_sync=true, std::string persistence_dir="")
Construct a new OnlinePlaygroundV2Identity.
Definition: Identity.cpp:71
static std::shared_ptr< DevelopmentIdentity > Development(std::string app_id="", uint64_t site_id=0, std::string persistence_dir="")
Construct a new DevelopmentIdentity.
Definition: Identity.cpp:29
static std::shared_ptr< OnlinePlaygroundIdentity > OnlinePlayground(std::string app_id, bool enable_ditto_cloud_sync=true, std::string persistence_dir="")
Construct a new OnlinePlaygroundIdentity.
Definition: Identity.cpp:64
static std::shared_ptr< ManualIdentity > Manual(std::string certificate_config)
Construct a new ManualIdentity.
Definition: Identity.cpp:87
static std::shared_ptr< SharedKeyIdentity > SharedKey(std::string app_id, std::string shared_key, uint64_t site_id=0, std::string persistence_dir="")
Construct a new SharedKeyIdentity.
Definition: Identity.cpp:80
static std::shared_ptr< OnlineIdentity > Online(std::string app_id, std::shared_ptr< AuthenticationCallback > callback, bool enable_ditto_cloud_sync=true, std::string custom_auth_url="", std::string persistence_dir="")
Construct a new OnlineIdentity.
Definition: Identity.cpp:43
static std::shared_ptr< OfflinePlaygroundIdentity > OfflinePlayground(std::string app_id="", uint64_t site_id=0, std::string persistence_dir="")
Construct a new OfflinePlaygroundIdentity.
Definition: Identity.cpp:36
A manually-provided certificate identity. This accepts a base64-encoded bundle.
Definition: Identity.hpp:491
std::string certificate_config
Definition: Identity.hpp:499
Develop peer-to-peer apps with no cloud connection. This mode offers no security and must only be use...
Definition: Identity.hpp:257
std::string app_id
Definition: Identity.hpp:264
uint64_t site_id
Definition: Identity.hpp:269
Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication serve...
Definition: Identity.hpp:301
std::string custom_auth_url
Definition: Identity.hpp:319
bool enable_ditto_cloud_sync
Definition: Identity.hpp:313
std::string app_id
Definition: Identity.hpp:308
Test a Ditto Cloud app without authentication ("Playground mode"). This mode offers no security and m...
Definition: Identity.hpp:393
std::string app_id
Definition: Identity.hpp:400
bool enable_ditto_cloud_sync
Definition: Identity.hpp:405
Test a Ditto Cloud app with weak shared token authentication ("Playground mode"). This is not secure ...
Definition: Identity.hpp:421
bool enable_ditto_cloud_sync
Definition: Identity.hpp:439
std::string token
Definition: Identity.hpp:434
std::string app_id
Definition: Identity.hpp:428
Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication serve...
Definition: Identity.hpp:355
std::string app_id
Definition: Identity.hpp:362
std::string custom_auth_url
Definition: Identity.hpp:373
bool enable_ditto_cloud_sync
Definition: Identity.hpp:367
A mode where any device is trusted provided they know the secret key. This is a simplistic authentica...
Definition: Identity.hpp:460
std::string shared_key
Definition: Identity.hpp:472
uint64_t site_id
Definition: Identity.hpp:477
std::string app_id
Definition: Identity.hpp:467