28class Authenticator :
public std::enable_shared_from_this<Authenticator> {
29 friend class AuthenticationStatusHandler;
30 friend class AuthenticationStatusObserver;
32 friend class LoginProvider;
33 friend class OnlinePlaygroundIdentity;
34 friend class OnlineWithAuthenticationIdentity;
58 void login(std::string token, std::string provider,
59 std::function<
void(std::unique_ptr<std::string>,
60 std::unique_ptr<DittoError>)>
73 DITTO_DEPRECATED_BECAUSE(
"Use `login` instead.")
75 std::string token, std::string provider,
76 std::function<
void(std::unique_ptr<DittoError>)> login_handler)
const;
90 std::string username, std::string password, std::string provider,
91 std::function<
void(std::unique_ptr<DittoError>)> login_handler)
const;
105 void logout(std::function<
void(Ditto)> cleanup = [](Ditto ditto) {})
const;
112 std::shared_ptr<Observer>
115 ~Authenticator() =
default;
119 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper;
120 std::weak_ptr<Ditto::Fields> weak_ditto_fields;
121 std::weak_ptr<AuthenticationCallback> callback;
122 std::vector<std::weak_ptr<AuthenticationStatusObserver>> status_observers;
124 Authenticator(std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper,
125 std::weak_ptr<Ditto::Fields> ditto_fields,
126 std::shared_ptr<AuthenticationCallback> callback);
128 void stop_status_observer(
129 std::shared_ptr<AuthenticationStatusObserver> status_observer);
130 void authentication_expiring(uint32_t time_remaining);
131 void update_and_notify(
bool should_notify);
void login(std::string token, std::string provider, std::function< void(std::unique_ptr< std::string >, std::unique_ptr< DittoError >)> login_handler) const
Log in to Ditto with a third-party token.
Definition Authenticator.cpp:27
void login_with_token(std::string token, std::string provider, std::function< void(std::unique_ptr< DittoError >)> login_handler) const
Log in to Ditto with a third-party token.
Definition Authenticator.cpp:55
void login_with_credentials(std::string username, std::string password, std::string provider, std::function< void(std::unique_ptr< DittoError >)> login_handler) const
Log in to Ditto with a username and password.
Definition Authenticator.cpp:72