| OLD | NEW |
| 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_CLIENT_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_THIRD_PARTY_CLIENT_AUTHENTICATOR_H_ |
| 6 #define REMOTING_PROTOCOL_THIRD_PARTY_CLIENT_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_THIRD_PARTY_CLIENT_AUTHENTICATOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // "hostjid:abc@example.com/123 clientjid:def@example.org/456". | 48 // "hostjid:abc@example.com/123 clientjid:def@example.org/456". |
| 49 // |token_fetched_callback| is called when the client authentication ends, | 49 // |token_fetched_callback| is called when the client authentication ends, |
| 50 // in the same thread |FetchThirdPartyToken| was originally called. | 50 // in the same thread |FetchThirdPartyToken| was originally called. |
| 51 // The request is canceled if the TokenFetcher is destroyed. | 51 // The request is canceled if the TokenFetcher is destroyed. |
| 52 virtual void FetchThirdPartyToken( | 52 virtual void FetchThirdPartyToken( |
| 53 const GURL& token_url, | 53 const GURL& token_url, |
| 54 const std::string& scope, | 54 const std::string& scope, |
| 55 const TokenFetchedCallback& token_fetched_callback) = 0; | 55 const TokenFetchedCallback& token_fetched_callback) = 0; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // Creates a third-party client authenticator for the host with the given | 58 // Creates a third-party client authenticator. |
| 59 // |host_public_key|. |token_fetcher| is used to get the authentication token. | 59 // |create_base_authenticator_callback| is used to create the base |
| 60 explicit ThirdPartyClientAuthenticator( | 60 // authenticator. |token_fetcher| is used to get the authentication token. |
| 61 ThirdPartyClientAuthenticator( |
| 62 const CreateBaseAuthenticatorCallback& create_base_authenticator_callback, |
| 61 scoped_ptr<TokenFetcher> token_fetcher); | 63 scoped_ptr<TokenFetcher> token_fetcher); |
| 62 ~ThirdPartyClientAuthenticator() override; | 64 ~ThirdPartyClientAuthenticator() override; |
| 63 | 65 |
| 64 protected: | 66 protected: |
| 65 // ThirdPartyAuthenticator implementation. | 67 // ThirdPartyAuthenticator implementation. |
| 66 void ProcessTokenMessage(const buzz::XmlElement* message, | 68 void ProcessTokenMessage(const buzz::XmlElement* message, |
| 67 const base::Closure& resume_callback) override; | 69 const base::Closure& resume_callback) override; |
| 68 void AddTokenElements(buzz::XmlElement* message) override; | 70 void AddTokenElements(buzz::XmlElement* message) override; |
| 69 | 71 |
| 70 private: | 72 private: |
| 71 void OnThirdPartyTokenFetched(const base::Closure& resume_callback, | 73 void OnThirdPartyTokenFetched(const base::Closure& resume_callback, |
| 72 const std::string& third_party_token, | 74 const std::string& third_party_token, |
| 73 const std::string& shared_secret); | 75 const std::string& shared_secret); |
| 74 | 76 |
| 77 CreateBaseAuthenticatorCallback create_base_authenticator_callback_; |
| 78 scoped_ptr<TokenFetcher> token_fetcher_; |
| 75 std::string token_; | 79 std::string token_; |
| 76 scoped_ptr<TokenFetcher> token_fetcher_; | |
| 77 | 80 |
| 78 DISALLOW_COPY_AND_ASSIGN(ThirdPartyClientAuthenticator); | 81 DISALLOW_COPY_AND_ASSIGN(ThirdPartyClientAuthenticator); |
| 79 }; | 82 }; |
| 80 | 83 |
| 81 | 84 |
| 82 } // namespace protocol | 85 } // namespace protocol |
| 83 } // namespace remoting | 86 } // namespace remoting |
| 84 | 87 |
| 85 #endif // REMOTING_PROTOCOL_THIRD_PARTY_CLIENT_AUTHENTICATOR_H_ | 88 #endif // REMOTING_PROTOCOL_THIRD_PARTY_CLIENT_AUTHENTICATOR_H_ |
| OLD | NEW |