| 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_AUTHENTICATOR_BASE_H_ | 5 #ifndef REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_ |
| 6 #define REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_ | 6 #define REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_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/authenticator.h" | 13 #include "remoting/protocol/authenticator.h" |
| 14 #include "third_party/webrtc/libjingle/xmllite/qname.h" | 14 #include "third_party/webrtc/libjingle/xmllite/qname.h" |
| 15 | 15 |
| 16 namespace buzz { | 16 namespace buzz { |
| 17 | 17 |
| 18 class XmlElement; | 18 class XmlElement; |
| 19 | 19 |
| 20 } // namespace buzz | 20 } // namespace buzz |
| 21 | 21 |
| 22 namespace remoting { | 22 namespace remoting { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 class ThirdPartyAuthenticatorBase : public Authenticator { | 34 class ThirdPartyAuthenticatorBase : public Authenticator { |
| 35 public: | 35 public: |
| 36 ~ThirdPartyAuthenticatorBase() override; | 36 ~ThirdPartyAuthenticatorBase() override; |
| 37 | 37 |
| 38 // Authenticator interface. | 38 // Authenticator interface. |
| 39 State state() const override; | 39 State state() const override; |
| 40 bool started() const override; | 40 bool started() const override; |
| 41 RejectionReason rejection_reason() const override; | 41 RejectionReason rejection_reason() const override; |
| 42 void ProcessMessage(const buzz::XmlElement* message, | 42 void ProcessMessage(const buzz::XmlElement* message, |
| 43 const base::Closure& resume_callback) override; | 43 const base::Closure& resume_callback) override; |
| 44 scoped_ptr<buzz::XmlElement> GetNextMessage() override; | 44 std::unique_ptr<buzz::XmlElement> GetNextMessage() override; |
| 45 const std::string& GetAuthKey() const override; | 45 const std::string& GetAuthKey() const override; |
| 46 scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override; | 46 std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator() |
| 47 const override; |
| 47 | 48 |
| 48 protected: | 49 protected: |
| 49 // XML tag names for third party authentication fields. | 50 // XML tag names for third party authentication fields. |
| 50 static const buzz::StaticQName kTokenUrlTag; | 51 static const buzz::StaticQName kTokenUrlTag; |
| 51 static const buzz::StaticQName kTokenScopeTag; | 52 static const buzz::StaticQName kTokenScopeTag; |
| 52 static const buzz::StaticQName kTokenTag; | 53 static const buzz::StaticQName kTokenTag; |
| 53 | 54 |
| 54 explicit ThirdPartyAuthenticatorBase(State initial_state); | 55 explicit ThirdPartyAuthenticatorBase(State initial_state); |
| 55 | 56 |
| 56 // Gives the message to the underlying authenticator for processing. | 57 // Gives the message to the underlying authenticator for processing. |
| 57 void ProcessUnderlyingMessage( | 58 void ProcessUnderlyingMessage( |
| 58 const buzz::XmlElement* message, | 59 const buzz::XmlElement* message, |
| 59 const base::Closure& resume_callback); | 60 const base::Closure& resume_callback); |
| 60 | 61 |
| 61 // Processes the token-related elements of the message. | 62 // Processes the token-related elements of the message. |
| 62 virtual void ProcessTokenMessage( | 63 virtual void ProcessTokenMessage( |
| 63 const buzz::XmlElement* message, | 64 const buzz::XmlElement* message, |
| 64 const base::Closure& resume_callback) = 0; | 65 const base::Closure& resume_callback) = 0; |
| 65 | 66 |
| 66 // Adds the token related XML elements to the message. | 67 // Adds the token related XML elements to the message. |
| 67 virtual void AddTokenElements(buzz::XmlElement* message) = 0; | 68 virtual void AddTokenElements(buzz::XmlElement* message) = 0; |
| 68 | 69 |
| 69 scoped_ptr<Authenticator> underlying_; | 70 std::unique_ptr<Authenticator> underlying_; |
| 70 State token_state_; | 71 State token_state_; |
| 71 bool started_; | 72 bool started_; |
| 72 RejectionReason rejection_reason_; | 73 RejectionReason rejection_reason_; |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 DISALLOW_COPY_AND_ASSIGN(ThirdPartyAuthenticatorBase); | 76 DISALLOW_COPY_AND_ASSIGN(ThirdPartyAuthenticatorBase); |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 } // namespace protocol | 79 } // namespace protocol |
| 79 } // namespace remoting | 80 } // namespace remoting |
| 80 | 81 |
| 81 #endif // REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_ | 82 #endif // REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_ |
| OLD | NEW |