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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_THIRD_PARTY_HOST_AUTHENTICATOR_H_ 5 #ifndef REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_
6 #define REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_ 6 #define REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_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/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "remoting/protocol/third_party_authenticator_base.h" 13 #include "remoting/protocol/third_party_authenticator_base.h"
14 14
15 namespace remoting { 15 namespace remoting {
16 namespace protocol { 16 namespace protocol {
17 17
18 class TokenValidator; 18 class TokenValidator;
19 19
20 // Implements the host side of the third party authentication mechanism. 20 // Implements the host side of the third party authentication mechanism.
21 // The host authenticator sends the |token_url| and |scope| obtained from the 21 // The host authenticator sends the |token_url| and |scope| obtained from the
22 // |TokenValidator| to the client, and expects a |token| in response. 22 // |TokenValidator| to the client, and expects a |token| in response.
23 // Once that token is received, it calls |TokenValidator| asynchronously to 23 // Once that token is received, it calls |TokenValidator| asynchronously to
24 // validate it, and exchange it for a |shared_secret|. Once the |TokenValidator| 24 // validate it, and exchange it for a |shared_secret|. Once the |TokenValidator|
25 // returns, the host uses the |shared_secret| to create an underlying 25 // returns, the host uses the |shared_secret| to create an underlying
26 // SPAKE2 authenticator, which is used to establish the encrypted connection. 26 // SPAKE2 authenticator, which is used to establish the encrypted connection.
27 class ThirdPartyHostAuthenticator : public ThirdPartyAuthenticatorBase { 27 class ThirdPartyHostAuthenticator : public ThirdPartyAuthenticatorBase {
28 public: 28 public:
29 // Creates a third-party host authenticator. 29 // Creates a third-party host authenticator.
30 // |create_base_authenticator_callback| is used to create the base 30 // |create_base_authenticator_callback| is used to create the base
31 // authenticator. |token_validator| contains the token parameters to be sent 31 // authenticator. |token_validator| contains the token parameters to be sent
32 // to the client and is used to obtain the shared secret. 32 // to the client and is used to obtain the shared secret.
33 ThirdPartyHostAuthenticator( 33 ThirdPartyHostAuthenticator(
34 const CreateBaseAuthenticatorCallback& create_base_authenticator_callback, 34 const CreateBaseAuthenticatorCallback& create_base_authenticator_callback,
35 scoped_ptr<TokenValidator> token_validator); 35 std::unique_ptr<TokenValidator> token_validator);
36 ~ThirdPartyHostAuthenticator() override; 36 ~ThirdPartyHostAuthenticator() override;
37 37
38 protected: 38 protected:
39 // ThirdPartyAuthenticator implementation. 39 // ThirdPartyAuthenticator implementation.
40 void ProcessTokenMessage(const buzz::XmlElement* message, 40 void ProcessTokenMessage(const buzz::XmlElement* message,
41 const base::Closure& resume_callback) override; 41 const base::Closure& resume_callback) override;
42 void AddTokenElements(buzz::XmlElement* message) override; 42 void AddTokenElements(buzz::XmlElement* message) override;
43 43
44 private: 44 private:
45 void OnThirdPartyTokenValidated(const buzz::XmlElement* message, 45 void OnThirdPartyTokenValidated(const buzz::XmlElement* message,
46 const base::Closure& resume_callback, 46 const base::Closure& resume_callback,
47 const std::string& shared_secret); 47 const std::string& shared_secret);
48 48
49 CreateBaseAuthenticatorCallback create_base_authenticator_callback_; 49 CreateBaseAuthenticatorCallback create_base_authenticator_callback_;
50 scoped_ptr<TokenValidator> token_validator_; 50 std::unique_ptr<TokenValidator> token_validator_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(ThirdPartyHostAuthenticator); 52 DISALLOW_COPY_AND_ASSIGN(ThirdPartyHostAuthenticator);
53 }; 53 };
54 54
55 } // namespace protocol 55 } // namespace protocol
56 } // namespace remoting 56 } // namespace remoting
57 57
58 #endif // REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_ 58 #endif // REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_
OLDNEW
« no previous file with comments | « remoting/protocol/third_party_client_authenticator.h ('k') | remoting/protocol/third_party_host_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698