21 #ifndef _THRIFT_TRANSPORT_TSASL_H_
22 #define _THRIFT_TRANSPORT_TSASL_H_ 1
34 #include <sasl/sasl.h>
35 #include <sasl/saslplug.h>
36 #include <sasl/saslutil.h>
39 #include <thrift/transport/TTransportException.h>
41 using namespace apache::thrift::transport;
73 virtual uint8_t* evaluateChallengeOrResponse(
const uint8_t* challenge,
74 uint32_t len, uint32_t* resLen) = 0;
87 uint8_t* unwrap(
const uint8_t* incoming,
const int offset,
88 const uint32_t len, uint32_t* outLen);
96 uint8_t* wrap(
const uint8_t* outgoing,
int offset,
97 const uint32_t len, uint32_t* outLen);
106 std::string getUsername();
125 TSaslClient(
const std::string& mechanisms,
const std::string& authorizationId,
126 const std::string&
protocol,
const std::string& serverName,
127 const std::map<std::string,std::string>& props,
128 sasl_callback_t* callbacks);
131 int result = sasl_client_init(callbacks);
132 if (result != SASL_OK)
137 uint8_t* evaluateChallengeOrResponse(
const uint8_t* challenge,
138 const uint32_t len, uint32_t* outLen);
141 virtual std::string getMechanismName();
144 std::string getNegotiatedProperty(
const std::string& propName);
147 virtual bool hasInitialResponse();
170 TSaslServer(
const std::string& service,
const std::string& serverFQDN,
171 const std::string& userRealm,
unsigned flags, sasl_callback_t* callbacks);
176 static void SaslInit(
const sasl_callback_t* callbacks,
const std::string& appname) {
177 int result = sasl_server_init(callbacks, appname.c_str());
178 if (result != SASL_OK) {
184 virtual uint8_t* evaluateChallengeOrResponse(
const uint8_t* challenge,
185 const uint32_t len, uint32_t* resLen);
const StringSearch UrlParser::protocol_search & protocol
SaslServerImplException(const char *errMsg)
SaslException(const char *msg)
static void SaslInit(const sasl_callback_t *callbacks, const std::string &appname)
virtual std::string getMechanismName()
SaslClientImplException(const char *errMsg)
uint8_t offset[7 *64-sizeof(uint64_t)]
virtual bool hasInitialResponse()
static void SaslInit(sasl_callback_t *callbacks)