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

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

Issue 12313085: Host-side third party token validation (Closed) Base URL: http://git.chromium.org/chromium/src.git@third_party_auth_protocol
Patch Set: Reviewer comments Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_NEGOTIATING_AUTHENTICATOR_H_ 5 #ifndef REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_
6 #define REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_ 6 #define REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "remoting/protocol/authenticator.h" 15 #include "remoting/protocol/authenticator.h"
16 #include "remoting/protocol/authentication_method.h" 16 #include "remoting/protocol/authentication_method.h"
17 #include "remoting/protocol/third_party_host_authenticator.h"
17 18
18 namespace remoting { 19 namespace remoting {
19 20
20 class RsaKeyPair; 21 class RsaKeyPair;
21 22
22 namespace protocol { 23 namespace protocol {
23 24
24 typedef base::Callback<void(const std::string& secret)> SecretFetchedCallback; 25 typedef base::Callback<void(const std::string& secret)> SecretFetchedCallback;
25 typedef base::Callback<void( 26 typedef base::Callback<void(
26 const SecretFetchedCallback& secret_fetched_callback)> FetchSecretCallback; 27 const SecretFetchedCallback& secret_fetched_callback)> FetchSecretCallback;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 public: 69 public:
69 virtual ~NegotiatingAuthenticator(); 70 virtual ~NegotiatingAuthenticator();
70 71
71 // Creates a client authenticator for the given methods. 72 // Creates a client authenticator for the given methods.
72 static scoped_ptr<Authenticator> CreateForClient( 73 static scoped_ptr<Authenticator> CreateForClient(
73 const std::string& authentication_tag, 74 const std::string& authentication_tag,
74 const FetchSecretCallback& fetch_secret_callback, 75 const FetchSecretCallback& fetch_secret_callback,
75 const std::vector<AuthenticationMethod>& methods); 76 const std::vector<AuthenticationMethod>& methods);
76 77
77 // Creates a host authenticator, using a fixed shared secret/PIN hash. 78 // Creates a host authenticator, using a fixed shared secret/PIN hash.
78 static scoped_ptr<Authenticator> CreateForHost( 79 static scoped_ptr<Authenticator> CreateForHostSharedSecret(
79 const std::string& local_cert, 80 const std::string& local_cert,
80 scoped_refptr<RsaKeyPair> key_pair, 81 scoped_refptr<RsaKeyPair> key_pair,
81 const std::string& shared_secret_hash, 82 const std::string& shared_secret_hash,
82 AuthenticationMethod::HashFunction hash_function); 83 AuthenticationMethod::HashFunction hash_function);
83 84
85 // Creates a host authenticator, using third party authentication.
86 static scoped_ptr<Authenticator> CreateForHostThirdParty(
87 const std::string& local_cert,
88 scoped_refptr<RsaKeyPair> key_pair,
89 const std::string& local_jid,
90 const std::string& remote_jid,
rmsousa 2013/03/25 22:45:58 Yeah, passing all these parameters 3-4 callstacks
91 scoped_refptr<ThirdPartyHostAuthenticator::TokenValidatorFactory>
92 token_validator_factory);
93
84 // Authenticator interface. 94 // Authenticator interface.
85 virtual State state() const OVERRIDE; 95 virtual State state() const OVERRIDE;
86 virtual RejectionReason rejection_reason() const OVERRIDE; 96 virtual RejectionReason rejection_reason() const OVERRIDE;
87 virtual void ProcessMessage(const buzz::XmlElement* message, 97 virtual void ProcessMessage(const buzz::XmlElement* message,
88 const base::Closure& resume_callback) OVERRIDE; 98 const base::Closure& resume_callback) OVERRIDE;
89 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; 99 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE;
90 virtual scoped_ptr<ChannelAuthenticator> 100 virtual scoped_ptr<ChannelAuthenticator>
91 CreateChannelAuthenticator() const OVERRIDE; 101 CreateChannelAuthenticator() const OVERRIDE;
92 102
93 private: 103 private:
(...skipping 22 matching lines...) Expand all
116 void CreateV2AuthenticatorWithSecret( 126 void CreateV2AuthenticatorWithSecret(
117 Authenticator::State initial_state, 127 Authenticator::State initial_state,
118 const base::Closure& resume_callback, 128 const base::Closure& resume_callback,
119 const std::string& shared_secret); 129 const std::string& shared_secret);
120 130
121 bool is_host_side() const; 131 bool is_host_side() const;
122 132
123 // Used only for host authenticators. 133 // Used only for host authenticators.
124 std::string local_cert_; 134 std::string local_cert_;
125 scoped_refptr<RsaKeyPair> local_key_pair_; 135 scoped_refptr<RsaKeyPair> local_key_pair_;
136
137 // Used only for shared secret host authenticators.
126 std::string shared_secret_hash_; 138 std::string shared_secret_hash_;
127 139
140 // Used only for third party host authenticators.
141 std::string local_jid_;
142 std::string remote_jid_;
143 scoped_refptr<ThirdPartyHostAuthenticator::TokenValidatorFactory>
144 token_validator_factory_;
145
128 // Used only for client authenticators. 146 // Used only for client authenticators.
129 std::string authentication_tag_; 147 std::string authentication_tag_;
130 FetchSecretCallback fetch_secret_callback_; 148 FetchSecretCallback fetch_secret_callback_;
131 149
132 // Used for both host and client authenticators. 150 // Used for both host and client authenticators.
133 std::vector<AuthenticationMethod> methods_; 151 std::vector<AuthenticationMethod> methods_;
134 AuthenticationMethod current_method_; 152 AuthenticationMethod current_method_;
135 scoped_ptr<Authenticator> current_authenticator_; 153 scoped_ptr<Authenticator> current_authenticator_;
136 State state_; 154 State state_;
137 RejectionReason rejection_reason_; 155 RejectionReason rejection_reason_;
138 156
139 base::WeakPtrFactory<NegotiatingAuthenticator> weak_factory_; 157 base::WeakPtrFactory<NegotiatingAuthenticator> weak_factory_;
140 158
141 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticator); 159 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticator);
142 }; 160 };
143 161
144 } // namespace protocol 162 } // namespace protocol
145 } // namespace remoting 163 } // namespace remoting
146 164
147 #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_ 165 #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_
OLDNEW
« no previous file with comments | « remoting/protocol/me2me_host_authenticator_factory.cc ('k') | remoting/protocol/negotiating_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698