| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PROTOCOL_TOKEN_VALIDATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_ |
| 6 #define REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_ | 6 #define REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace remoting { | 15 namespace remoting { |
| 16 | 16 |
| 17 class RsaKeyPair; | 17 class RsaKeyPair; |
| 18 | 18 |
| 19 namespace protocol { | 19 namespace protocol { |
| 20 | 20 |
| 21 // The |TokenValidator| encapsulates the parameters to be sent to the client | 21 // The |TokenValidator| encapsulates the parameters to be sent to the client |
| 22 // to obtain a token, and the method to validate that token and obtain the | 22 // to obtain a token, and the method to validate that token and obtain the |
| (...skipping 24 matching lines...) Expand all Loading... |
| 47 // client, and require the token received in response to match. | 47 // client, and require the token received in response to match. |
| 48 virtual const std::string& token_scope() const = 0; | 48 virtual const std::string& token_scope() const = 0; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // Factory for |TokenValidator|. | 51 // Factory for |TokenValidator|. |
| 52 class TokenValidatorFactory | 52 class TokenValidatorFactory |
| 53 : public base::RefCountedThreadSafe<TokenValidatorFactory> { | 53 : public base::RefCountedThreadSafe<TokenValidatorFactory> { |
| 54 public: | 54 public: |
| 55 // Creates a TokenValidator. |local_jid| and |remote_jid| are used to create | 55 // Creates a TokenValidator. |local_jid| and |remote_jid| are used to create |
| 56 // a token scope that is restricted to the current connection's JIDs. | 56 // a token scope that is restricted to the current connection's JIDs. |
| 57 virtual scoped_ptr<TokenValidator> CreateTokenValidator( | 57 virtual std::unique_ptr<TokenValidator> CreateTokenValidator( |
| 58 const std::string& local_jid, | 58 const std::string& local_jid, |
| 59 const std::string& remote_jid) = 0; | 59 const std::string& remote_jid) = 0; |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 friend class base::RefCountedThreadSafe<TokenValidatorFactory>; | 62 friend class base::RefCountedThreadSafe<TokenValidatorFactory>; |
| 63 | 63 |
| 64 virtual ~TokenValidatorFactory() {} | 64 virtual ~TokenValidatorFactory() {} |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace protocol | 67 } // namespace protocol |
| 68 } // namespace remoting | 68 } // namespace remoting |
| 69 | 69 |
| 70 #endif // REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_ | 70 #endif // REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_ |
| OLD | NEW |