| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BLIMP_NET_ENGINE_AUTHENTICATION_HANDLER_H_ | |
| 6 #define BLIMP_NET_ENGINE_AUTHENTICATION_HANDLER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "blimp/net/blimp_net_export.h" | |
| 15 #include "blimp/net/connection_handler.h" | |
| 16 | |
| 17 namespace blimp { | |
| 18 | |
| 19 class BlimpConnection; | |
| 20 | |
| 21 // Authenticates connections and passes successfully authenticated connections | |
| 22 // to |connection_handler|. | |
| 23 class BLIMP_NET_EXPORT EngineAuthenticationHandler : public ConnectionHandler { | |
| 24 public: | |
| 25 // |client_auth_token|: used to authenticate incoming connection. | |
| 26 // |connection_handler|: a new connection is passed on to it after the | |
| 27 // connection is authenticate this handler. | |
| 28 EngineAuthenticationHandler(ConnectionHandler* connection_handler, | |
| 29 const std::string& client_auth_token); | |
| 30 | |
| 31 ~EngineAuthenticationHandler() override; | |
| 32 | |
| 33 // ConnectionHandler implementation. | |
| 34 void HandleConnection(std::unique_ptr<BlimpConnection> connection) override; | |
| 35 | |
| 36 private: | |
| 37 // Used to abandon pending authenticated connections if |this| is deleted. | |
| 38 base::WeakPtrFactory<ConnectionHandler> connection_handler_weak_factory_; | |
| 39 | |
| 40 // Used to authenticate incoming connection. Engine is assigned to one client | |
| 41 // only, and all connections from that client shall carry the same token. | |
| 42 const std::string client_auth_token_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(EngineAuthenticationHandler); | |
| 45 }; | |
| 46 | |
| 47 } // namespace blimp | |
| 48 | |
| 49 #endif // BLIMP_NET_ENGINE_AUTHENTICATION_HANDLER_H_ | |
| OLD | NEW |