1#ifndef _DITTO_IDENTITY_
2#define _DITTO_IDENTITY_
4#include "AuthenticationCallback.hpp"
15class OfflinePlaygroundIdentity;
16class OnlineWithAuthenticationIdentity;
17class OnlinePlaygroundIdentity;
18class SharedKeyIdentity;
24enum class IdentityType {
26 ONLINE_WITH_AUTHENTICATION,
77 static std::shared_ptr<OfflinePlaygroundIdentity>
91 static std::shared_ptr<OnlineWithAuthenticationIdentity>
93 std::shared_ptr<AuthenticationCallback> callback,
94 bool enable_ditto_cloud_sync =
true,
95 std::string custom_auth_url =
"");
110 static std::shared_ptr<OnlinePlaygroundIdentity>
112 bool enable_ditto_cloud_sync =
true);
124 static std::shared_ptr<SharedKeyIdentity>
125 SharedKey(std::string app_id, std::string shared_key, uint64_t site_id = 0);
133 static std::shared_ptr<ManualIdentity>
Manual(std::string certificate_config);
136 virtual std::string get_app_id()
const final;
137 virtual std::shared_ptr<Authenticator> get_authenticator()
const;
138 virtual bool get_enable_ditto_cloud_sync()
const;
139 virtual bool requires_offline_license_token()
const;
146 virtual std::shared_ptr<CAuthClient_t>
147 authenticate(std::string persistence_dir =
"") = 0;
149 std::shared_ptr<CAuthClient_t> auth_client;
170 std::shared_ptr<CAuthClient_t> authenticate(std::string persistence_dir =
"");
171 bool requires_offline_license_token()
const;
211 std::string app_id, std::shared_ptr<AuthenticationCallback> callback,
215 bool get_enable_ditto_cloud_sync()
const;
216 std::shared_ptr<Authenticator> get_authenticator()
const;
217 std::shared_ptr<CAuthClient_t> authenticate(std::string persistence_dir =
"");
218 std::shared_ptr<Authenticator> authenticator;
219 std::shared_ptr<LoginProvider> login_provider;
220 std::shared_ptr<AuthenticationCallback> callback;
221 bool requires_offline_license_token()
const;
249 std::string get_token()
const;
250 bool get_enable_ditto_cloud_sync()
const;
251 bool requires_offline_license_token()
const;
252 std::shared_ptr<Authenticator> get_authenticator()
const;
253 std::shared_ptr<CAuthClient_t> authenticate(std::string persistence_dir =
"");
254 std::shared_ptr<Authenticator> authenticator;
282 bool requires_offline_license_token()
const;
283 std::shared_ptr<CAuthClient_t> authenticate(std::string persistence_dir =
"");
301 std::shared_ptr<CAuthClient_t> authenticate(std::string persistence_dir =
"");
303 bool requires_offline_license_token()
const;
The entrypoint to the Ditto SDK.
Definition: Ditto.hpp:27
The various identity configurations that you can use when initializing a Ditto instance.
Definition: Identity.hpp:53
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:51
static std::shared_ptr< OfflinePlaygroundIdentity > OfflinePlayground(std::string app_id="", uint64_t site_id=0)
Construct a new OfflinePlaygroundIdentity.
Definition: Identity.cpp:36
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:58
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:42
static std::shared_ptr< ManualIdentity > Manual(std::string certificate_config)
Construct a new ManualIdentity.
Definition: Identity.cpp:65
A manually-provided certificate identity. This accepts a base64-encoded bundle.
Definition: Identity.hpp:290
std::string certificate_config
Definition: Identity.hpp:298
Develop peer-to-peer apps with no cloud connection. This mode offers no security and must only be use...
Definition: Identity.hpp:157
uint64_t site_id
Definition: Identity.hpp:164
Test a Ditto Cloud app with weak shared token authentication ("Playground mode"). This is not secure ...
Definition: Identity.hpp:229
std::string token
Definition: Identity.hpp:237
bool enable_ditto_cloud_sync
Definition: Identity.hpp:242
Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication serve...
Definition: Identity.hpp:194
std::string custom_auth_url
Definition: Identity.hpp:207
bool enable_ditto_cloud_sync
Definition: Identity.hpp:201
A mode where any device is trusted provided they know the secret key. This is a simplistic authentica...
Definition: Identity.hpp:263
std::string shared_key
Definition: Identity.hpp:270
uint64_t site_id
Definition: Identity.hpp:275