Infinispan HotRod C++ Client 9.2.0.Final
Loading...
Searching...
No Matches
AuthenticationConfiguration.h
Go to the documentation of this file.
1/*
2 * AuthenticationConfiguration.h
3 *
4 * Created on: Jan 27, 2017
5 * Author: rigazilla
6 */
7
8#ifndef INCLUDE_INFINISPAN_HOTROD_AUTHENTICATIONCONFIGURATION_H_
9#define INCLUDE_INFINISPAN_HOTROD_AUTHENTICATIONCONFIGURATION_H_
10namespace infinispan {
11namespace hotrod {
12
13#if !defined _WIN32 && !defined _WIN64
14#include "sasl/sasl.h"
15
16#else
17#define SASL_CB_USER 0x4001
18#define SASL_CB_AUTHNAME 0x4002
19#define SASL_CB_PASS 0x4004
20#define SASL_CB_GETREALM 0x4008
21#define SASL_CB_GETPATH 0x0003
22#define SASL_CB_LIST_END 0x0000
23
24#define SASL_OK 0 /* successful result */
25#define SASL_BADPARAM -7
26
27typedef struct sasl_callback {
28 /* Identifies the type of the callback function.
29 * Mechanisms must ignore callbacks with id's they don't recognize.
30 */
31 unsigned long id;
32 int (*proc)(void);
33 void *context;
34} sasl_callback_t;
35
36/* Plain text password structure.
37 * len is the length of the password, data is the text.
38 */
39typedef struct sasl_secret {
40 unsigned long len;
41 unsigned char data[1]; /* variable sized */
42} sasl_secret_t;
43
44#endif
45
46typedef int (*sasl_callback_ft)(void);
47
55{
56public:
57 AuthenticationConfiguration(std::vector<sasl_callback_t> callbackHandler, bool enabled, std::string saslMechanism, std::string serverFQDN)
58 : enabled(enabled), callbackHandler(callbackHandler), saslMechanism(saslMechanism), serverFQDN(serverFQDN) {}
59 AuthenticationConfiguration() : enabled(false) {}
60 bool isEnabled() const { return enabled; }
61
65 const std::string& getSaslMechanism() const {
66 return saslMechanism;
67 }
68
72 const std::vector<sasl_callback_t>& getCallbackHandler() const {
73 return callbackHandler;
74 }
75
79 const std::string& getServerFqdn() const {
80 return serverFQDN;
81 }
82
83private:
84 bool enabled;
85 std::vector<sasl_callback_t> callbackHandler;
86 std::string saslMechanism;
87 std::string serverFQDN;
88};
89
90}}
91
92#endif /* INCLUDE_INFINISPAN_HOTROD_AUTHENTICATIONCONFIGURATION_H_ */
Definition: AuthenticationConfiguration.h:55
const std::string & getServerFqdn() const
Definition: AuthenticationConfiguration.h:79
const std::string & getSaslMechanism() const
Definition: AuthenticationConfiguration.h:65
const std::vector< sasl_callback_t > & getCallbackHandler() const
Definition: AuthenticationConfiguration.h:72
AuthenticationConfiguration(std::vector< sasl_callback_t > callbackHandler, bool enabled, std::string saslMechanism, std::string serverFQDN)
Definition: AuthenticationConfiguration.h:57
AuthenticationConfiguration()
Definition: AuthenticationConfiguration.h:59
bool isEnabled() const
Definition: AuthenticationConfiguration.h:60
int(* sasl_callback_ft)(void)
Definition: AuthenticationConfiguration.h:46
Definition: AuthenticationConfiguration.h:10