pulsar-client-cpp
Authentication.h
1 
19 #ifndef PULSAR_AUTHENTICATION_H_
20 #define PULSAR_AUTHENTICATION_H_
21 
22 #include <vector>
23 #include <string>
24 #include <map>
25 #include <boost/shared_ptr.hpp>
26 #include <pulsar/Result.h>
27 #include <boost/make_shared.hpp>
28 
29 #pragma GCC visibility push(default)
30 
31 namespace pulsar {
32 
33  class ClientConfiguration;
34  class Authentication;
35 
37  public:
38  virtual ~AuthenticationDataProvider();
39  virtual bool hasDataForTls();
40  virtual std::string getTlsCertificates();
41  virtual std::string getTlsPrivateKey();
42  virtual bool hasDataForHttp();
43  virtual std::string getHttpAuthType();
44  virtual std::string getHttpHeaders();
45  virtual bool hasDataFromCommand();
46  virtual std::string getCommandData();
47  protected:
49  };
50 
51  typedef boost::shared_ptr<AuthenticationDataProvider> AuthenticationDataPtr;
52  typedef boost::shared_ptr<Authentication> AuthenticationPtr;
53  typedef std::map<std::string, std::string> ParamMap;
54 
56  public:
57  virtual ~Authentication();
58  virtual const std::string getAuthMethodName() const = 0;
59  virtual Result getAuthData(AuthenticationDataPtr& authDataContent) const {
60  authDataContent = authData_;
61  return ResultOk;
62  }
63  protected:
65  AuthenticationDataPtr authData_;
66  friend class ClientConfiguration;
67  };
68 
69  class AuthFactory {
70  public:
71  static AuthenticationPtr Disabled();
72  static AuthenticationPtr create(const std::string& dynamicLibPath);
73  static AuthenticationPtr create(const std::string& dynamicLibPath, const std::string& authParamsString);
74  static AuthenticationPtr create(const std::string& dynamicLibPath, ParamMap& params);
75 
76  protected:
77  static bool isShutdownHookRegistered_;
78  static std::vector<void *> loadedLibrariesHandles_;
79  static void release_handles();
80  };
81 }
82 // namespace pulsar
83 
84 #pragma GCC visibility pop
85 
86 #endif /* PULSAR_AUTHENTICATION_H_ */
Definition: Authentication.h:31
Definition: Authentication.h:55
Definition: Authentication.h:69
Result
Definition: Result.h:31
Definition: Authentication.h:36
Definition: ClientConfiguration.h:27