Aktualizr
C++ SOTA Client
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
oauth2.h
1 #ifndef SOTA_CLIENT_TOOLS_OAUTH2_H_
2 #define SOTA_CLIENT_TOOLS_OAUTH2_H_
3 
4 #include <string>
5 #include <utility>
6 
7 enum class AuthenticationResult { kSuccess = 0, kFailure };
8 
9 class OAuth2 {
10  public:
11  /**
12  * Doesn't perform any authentication
13  */
14  OAuth2(std::string server, std::string client_id, std::string client_secret, std::string ca_certs)
15  : server_(std::move(server)),
16  client_id_(std::move(client_id)),
17  client_secret_(std::move(client_secret)),
18  ca_certs_(std::move(ca_certs)) {}
19 
20  /**
21  * Synchronously attempt to get an access token from Auth+
22  */
23  AuthenticationResult Authenticate();
24 
25  std::string token() const { return token_; }
26 
27  private:
28  const std::string server_;
29  const std::string client_id_;
30  const std::string client_secret_;
31  const std::string ca_certs_;
32  std::string token_;
33 };
34 
35 // vim: set tabstop=2 shiftwidth=2 expandtab:
36 #endif // SOTA_CLIENT_TOOLS_OAUTH2_H_
OAuth2(std::string server, std::string client_id, std::string client_secret, std::string ca_certs)
Doesn&#39;t perform any authentication.
Definition: oauth2.h:14
STL namespace.
Definition: oauth2.h:9