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

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: Add missing parameters Created 7 years, 8 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(
Sergey Ulanov 2013/03/28 22:34:54 maybe CreateForHostWithSharedSecret()?
rmsousa 2013/04/04 22:13:43 Done.
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 GURL& token_url,
90 const GURL& token_validation_url,
91 const std::string& local_jid,
92 const std::string& remote_jid,
93 ThirdPartyHostAuthenticator::TokenValidatorFactory*
94 token_validator_factory);
95
84 // Authenticator interface. 96 // Authenticator interface.
85 virtual State state() const OVERRIDE; 97 virtual State state() const OVERRIDE;
86 virtual RejectionReason rejection_reason() const OVERRIDE; 98 virtual RejectionReason rejection_reason() const OVERRIDE;
87 virtual void ProcessMessage(const buzz::XmlElement* message, 99 virtual void ProcessMessage(const buzz::XmlElement* message,
88 const base::Closure& resume_callback) OVERRIDE; 100 const base::Closure& resume_callback) OVERRIDE;
89 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; 101 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE;
90 virtual scoped_ptr<ChannelAuthenticator> 102 virtual scoped_ptr<ChannelAuthenticator>
91 CreateChannelAuthenticator() const OVERRIDE; 103 CreateChannelAuthenticator() const OVERRIDE;
92 104
93 private: 105 private:
(...skipping 22 matching lines...) Expand all
116 void CreateV2AuthenticatorWithSecret( 128 void CreateV2AuthenticatorWithSecret(
117 Authenticator::State initial_state, 129 Authenticator::State initial_state,
118 const base::Closure& resume_callback, 130 const base::Closure& resume_callback,
119 const std::string& shared_secret); 131 const std::string& shared_secret);
120 132
121 bool is_host_side() const; 133 bool is_host_side() const;
122 134
123 // Used only for host authenticators. 135 // Used only for host authenticators.
124 std::string local_cert_; 136 std::string local_cert_;
125 scoped_refptr<RsaKeyPair> local_key_pair_; 137 scoped_refptr<RsaKeyPair> local_key_pair_;
138
139 // Used only for shared secret host authenticators.
126 std::string shared_secret_hash_; 140 std::string shared_secret_hash_;
127 141
142 // Used only for third party host authenticators.
143 std::string local_jid_;
144 std::string remote_jid_;
145 GURL token_url_;
146 GURL token_validation_url_;
147 ThirdPartyHostAuthenticator::TokenValidatorFactory* token_validator_factory_;
148
128 // Used only for client authenticators. 149 // Used only for client authenticators.
129 std::string authentication_tag_; 150 std::string authentication_tag_;
130 FetchSecretCallback fetch_secret_callback_; 151 FetchSecretCallback fetch_secret_callback_;
131 152
132 // Used for both host and client authenticators. 153 // Used for both host and client authenticators.
133 std::vector<AuthenticationMethod> methods_; 154 std::vector<AuthenticationMethod> methods_;
134 AuthenticationMethod current_method_; 155 AuthenticationMethod current_method_;
135 scoped_ptr<Authenticator> current_authenticator_; 156 scoped_ptr<Authenticator> current_authenticator_;
136 State state_; 157 State state_;
137 RejectionReason rejection_reason_; 158 RejectionReason rejection_reason_;
138 159
139 base::WeakPtrFactory<NegotiatingAuthenticator> weak_factory_; 160 base::WeakPtrFactory<NegotiatingAuthenticator> weak_factory_;
140 161
141 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticator); 162 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticator);
142 }; 163 };
143 164
144 } // namespace protocol 165 } // namespace protocol
145 } // namespace remoting 166 } // namespace remoting
146 167
147 #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_ 168 #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698