@@ -23,37 +23,50 @@ namespace arrow {
2323namespace flight {
2424
2525ServerAuthHandler::~ServerAuthHandler () {}
26- // -AL- todo: write class read/write auth handler for our mock server.
27- // I think it is needed for stable behavior.
26+
2827NoOpAuthHandler::~NoOpAuthHandler () {}
2928Status NoOpAuthHandler::Authenticate (const ServerCallContext& context,
3029 ServerAuthSender* outgoing,
3130 ServerAuthReader* incoming) {
31+ return Status::OK ();
32+ }
33+
34+ Status NoOpAuthHandler::IsValid (const ServerCallContext& context,
35+ const std::string& token, std::string* peer_identity) {
36+ *peer_identity = " " ;
37+ return Status::OK ();
38+ }
39+
40+ // -AL- TestServerAuthHandler should be the most similar here.
41+ DoNothingHandler::~DoNothingHandler () {}
42+ Status DoNothingHandler::Authenticate (const ServerCallContext& context,
43+ ServerAuthSender* outgoing,
44+ ServerAuthReader* incoming) {
3245 // -AL- If this approach does work, I need to create a new handler to for the mock server.
33- ARROW_LOG (DEBUG) << " NoOpAuthHandler ::Authenticate - Reading response from client" ;
46+ ARROW_LOG (DEBUG) << " DoNothingHandler ::Authenticate - Reading response from client" ;
3447 std::string client_token;
3548 RETURN_NOT_OK (incoming->Read (&client_token)); // Read client's message
36- ARROW_LOG (DEBUG) << " NoOpAuthHandler ::Authenticate - client_token: " << client_token;
49+ ARROW_LOG (DEBUG) << " DoNothingHandler ::Authenticate - client_token: " << client_token;
3750
3851 // -AL- do not write anything, to match real server like dbt
39- // ARROW_LOG(DEBUG) << "NoOpAuthHandler ::Authenticate - write response from server";
40- // // Validate token, then write response
41- // RETURN_NOT_OK(outgoing->Write("server-response")); // Write response!
42-
43- ARROW_LOG (DEBUG) << " NoOpAuthHandler ::Authenticate 1" ;
44- while (incoming->Read (&client_token).ok ()) {
45- // Discard remaining messages
46- ARROW_LOG (DEBUG) << " NoOpAuthHandler ::Authenticate - drain messages from client" ;
47- }
48- ARROW_LOG (DEBUG) << " NoOpAuthHandler ::Authenticate 2" ;
52+ ARROW_LOG (DEBUG) << " DoNothingHandler ::Authenticate - write response from server" ;
53+ // Validate token, then write response
54+ RETURN_NOT_OK (outgoing->Write (" server-response" )); // Write response!
55+
56+ ARROW_LOG (DEBUG) << " DoNothingHandler ::Authenticate 1" ;
57+ // while (incoming->Read(&client_token).ok()) {
58+ // // Discard remaining messages
59+ // ARROW_LOG(DEBUG) << "DoNothingHandler ::Authenticate - drain messages from client";
60+ // }
61+ // ARROW_LOG(DEBUG) << "DoNothingHandler ::Authenticate 2";
4962 return Status::OK ();
5063}
5164
52- Status NoOpAuthHandler ::IsValid (const ServerCallContext& context,
65+ Status DoNothingHandler ::IsValid (const ServerCallContext& context,
5366 const std::string& token, std::string* peer_identity) {
54- ARROW_LOG (DEBUG) << " NoOpAuthHandler ::IsValid 1" ; // -AL- TEMP
67+ ARROW_LOG (DEBUG) << " DoNothingHandler ::IsValid 1" ; // -AL- TEMP
5568 *peer_identity = " " ;
56- ARROW_LOG (DEBUG) << " NoOpAuthHandler ::IsValid 2" ; // -AL- TEMP
69+ ARROW_LOG (DEBUG) << " DoNothingHandler ::IsValid 2" ; // -AL- TEMP
5770 return Status::OK ();
5871}
5972
0 commit comments