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,
96 static std::shared_ptr<DevelopmentIdentity>
97 Development(std::string app_id =
"", uint64_t site_id = 0,
98 std::string persistence_dir =
"");
113 static std::shared_ptr<OfflinePlaygroundIdentity>
115 std::string persistence_dir =
"");
132 static std::shared_ptr<OnlineIdentity>
133 Online(std::string app_id, std::shared_ptr<AuthenticationCallback> callback,
134 bool enable_ditto_cloud_sync =
true, std::string custom_auth_url =
"",
135 std::string persistence_dir =
"");
150 static std::shared_ptr<OnlineWithAuthenticationIdentity>
152 std::shared_ptr<AuthenticationCallback> callback,
153 bool enable_ditto_cloud_sync =
true,
154 std::string custom_auth_url =
"",
155 std::string persistence_dir =
"");
167 static std::shared_ptr<OnlinePlaygroundIdentity>
169 std::string persistence_dir =
"");
187 static std::shared_ptr<OnlinePlaygroundV2Identity>
189 bool enable_ditto_cloud_sync =
true,
190 std::string persistence_dir =
"");
204 static std::shared_ptr<SharedKeyIdentity>
205 SharedKey(std::string app_id, std::string shared_key, uint64_t site_id = 0,
206 std::string persistence_dir =
"");
214 static std::shared_ptr<ManualIdentity>
Manual(std::string certificate_config);
217 virtual std::string get_app_id()
const;
218 virtual std::shared_ptr<Authenticator> get_authenticator()
const;
219 virtual bool get_enable_ditto_cloud_sync()
const;
220 virtual bool requires_offline_license_token()
const;
221 std::shared_ptr<CAuthClient_t> auth_client;
247 std::string persistence_dir);
249 std::string get_app_id()
const;
250 bool requires_offline_license_token()
const;
274 std::string persistence_dir);
276 std::string get_app_id()
const;
277 bool requires_offline_license_token()
const;
324 std::shared_ptr<AuthenticationCallback> callback,
326 std::string persistence_dir);
328 std::string get_app_id()
const;
329 bool get_enable_ditto_cloud_sync()
const;
330 std::shared_ptr<Authenticator> get_authenticator();
331 std::shared_ptr<Authenticator> authenticator;
332 std::shared_ptr<LoginProvider> login_provider;
333 bool requires_offline_license_token()
const;
378 std::string
app_id, std::shared_ptr<AuthenticationCallback> callback,
380 std::string persistence_dir);
382 std::string get_app_id()
const;
383 bool get_enable_ditto_cloud_sync()
const;
384 std::shared_ptr<Authenticator> get_authenticator()
const;
385 std::shared_ptr<Authenticator> authenticator;
386 std::shared_ptr<LoginProvider> login_provider;
387 bool requires_offline_license_token()
const;
410 std::string persistence_dir);
412 std::string get_app_id()
const;
413 bool get_enable_ditto_cloud_sync()
const;
414 bool requires_offline_license_token()
const;
445 std::string persistence_dir);
447 std::string get_app_id()
const;
448 std::string get_token()
const;
449 bool get_enable_ditto_cloud_sync()
const;
450 bool requires_offline_license_token()
const;
451 std::shared_ptr<Authenticator> get_authenticator()
const;
452 std::shared_ptr<Authenticator> authenticator;
482 std::string persistence_dir);
484 std::string get_app_id()
const;
485 bool requires_offline_license_token()
const;
504 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:231
uint64_t site_id
Definition: Identity.hpp:243
std::string app_id
Definition: Identity.hpp:238
The entrypoint to the Ditto SDK.
Definition: Ditto.hpp:22
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:51
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:69
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:27
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:62
static std::shared_ptr< ManualIdentity > Manual(std::string certificate_config)
Construct a new ManualIdentity.
Definition: Identity.cpp:85
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:78
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:41
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:34
A manually-provided certificate identity. This accepts a base64-encoded bundle.
Definition: Identity.hpp:492
std::string certificate_config
Definition: Identity.hpp:500
Develop peer-to-peer apps with no cloud connection. This mode offers no security and must only be use...
Definition: Identity.hpp:258
std::string app_id
Definition: Identity.hpp:265
uint64_t site_id
Definition: Identity.hpp:270
Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication serve...
Definition: Identity.hpp:302
std::string custom_auth_url
Definition: Identity.hpp:320
bool enable_ditto_cloud_sync
Definition: Identity.hpp:314
std::string app_id
Definition: Identity.hpp:309
Test a Ditto Cloud app without authentication ("Playground mode"). This mode offers no security and m...
Definition: Identity.hpp:394
std::string app_id
Definition: Identity.hpp:401
bool enable_ditto_cloud_sync
Definition: Identity.hpp:406
Test a Ditto Cloud app with weak shared token authentication ("Playground mode"). This is not secure ...
Definition: Identity.hpp:422
bool enable_ditto_cloud_sync
Definition: Identity.hpp:440
std::string token
Definition: Identity.hpp:435
std::string app_id
Definition: Identity.hpp:429
Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication serve...
Definition: Identity.hpp:356
std::string app_id
Definition: Identity.hpp:363
std::string custom_auth_url
Definition: Identity.hpp:374
bool enable_ditto_cloud_sync
Definition: Identity.hpp:368
A mode where any device is trusted provided they know the secret key. This is a simplistic authentica...
Definition: Identity.hpp:461
std::string shared_key
Definition: Identity.hpp:473
uint64_t site_id
Definition: Identity.hpp:478
std::string app_id
Definition: Identity.hpp:468