Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: remoting/protocol/token_validator.h

Issue 1788443005: Make TokenValidatorFactory ref-counted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/negotiating_host_authenticator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 namespace remoting { 15 namespace remoting {
15 16
16 class RsaKeyPair; 17 class RsaKeyPair;
17 18
18 namespace protocol { 19 namespace protocol {
19 20
20 // The |TokenValidator| encapsulates the parameters to be sent to the client 21 // The |TokenValidator| encapsulates the parameters to be sent to the client
(...skipping 20 matching lines...) Expand all
41 42
42 // URL sent to the client, to be used by its |TokenFetcher| to get a token. 43 // URL sent to the client, to be used by its |TokenFetcher| to get a token.
43 virtual const GURL& token_url() const = 0; 44 virtual const GURL& token_url() const = 0;
44 45
45 // Space-separated list of connection attributes the host must send to the 46 // Space-separated list of connection attributes the host must send to the
46 // client, and require the token received in response to match. 47 // client, and require the token received in response to match.
47 virtual const std::string& token_scope() const = 0; 48 virtual const std::string& token_scope() const = 0;
48 }; 49 };
49 50
50 // Factory for |TokenValidator|. 51 // Factory for |TokenValidator|.
51 class TokenValidatorFactory { 52 class TokenValidatorFactory
53 : public base::RefCountedThreadSafe<TokenValidatorFactory> {
52 public: 54 public:
53 virtual ~TokenValidatorFactory() {}
54
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 scoped_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
61 protected:
62 friend class base::RefCountedThreadSafe<TokenValidatorFactory>;
63
64 virtual ~TokenValidatorFactory() {}
60 }; 65 };
61 66
62 } // namespace protocol 67 } // namespace protocol
63 } // namespace remoting 68 } // namespace remoting
64 69
65 #endif // REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_ 70 #endif // REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_
OLDNEW
« no previous file with comments | « remoting/protocol/negotiating_host_authenticator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698