OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_HOST_USER_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_HOST_USER_AUTHENTICATOR_H_ |
6 #define REMOTING_HOST_USER_AUTHENTICATOR_H_ | 6 #define REMOTING_HOST_USER_AUTHENTICATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 |
10 namespace remoting { | 12 namespace remoting { |
11 | 13 |
12 // Interface for authenticating users for access to remote desktop session. | 14 // Interface for authenticating users for access to remote desktop session. |
13 // Implementation is platform-specific. | 15 // Implementation is platform-specific. |
14 // Implementations may assume each instance of this class handles only a | 16 // Implementations may assume each instance of this class handles only a |
15 // single Authenticate request. | 17 // single Authenticate request. |
16 | 18 |
17 // TODO(lambroslambrou): Decide whether this needs an asychronous interface | 19 // TODO(lambroslambrou): Decide whether this needs an asychronous interface |
18 // (for example AuthenticateStart()..AuthenticateEndCallback()), or whether the | 20 // (for example AuthenticateStart()..AuthenticateEndCallback()), or whether the |
19 // multi-threading policy could be handled by the caller. | 21 // multi-threading policy could be handled by the caller. |
20 class UserAuthenticator { | 22 class UserAuthenticator : public base::RefCountedThreadSafe<UserAuthenticator> { |
21 public: | 23 public: |
22 virtual ~UserAuthenticator() {} | 24 virtual ~UserAuthenticator() {} |
23 | 25 |
24 // Create platform-specific authenticator. | 26 // Create platform-specific authenticator. |
25 static UserAuthenticator* Create(); | 27 static UserAuthenticator* Create(); |
26 | 28 |
27 // Authenticate a user, returning true if the username/password are valid. | 29 // Authenticate a user, returning true if the username/password are valid. |
28 virtual bool Authenticate(const std::string& username, | 30 virtual bool Authenticate(const std::string& username, |
29 const std::string& password) = 0; | 31 const std::string& password) = 0; |
30 }; | 32 }; |
31 | 33 |
32 } // namespace remoting | 34 } // namespace remoting |
33 | 35 |
34 #endif // REMOTING_HOST_USER_AUTHENTICATOR_H_ | 36 #endif // REMOTING_HOST_USER_AUTHENTICATOR_H_ |
OLD | NEW |