Chromium Code Reviews| Index: remoting/protocol/negotiating_authenticator_base.h |
| diff --git a/remoting/protocol/negotiating_authenticator_base.h b/remoting/protocol/negotiating_authenticator_base.h |
| index 4d67a808964ce32ba2faf9ce869ec1fc61b8f376..b25f41303186b23c335f734cd1fc5966f4ffabea 100644 |
| --- a/remoting/protocol/negotiating_authenticator_base.h |
| +++ b/remoting/protocol/negotiating_authenticator_base.h |
| @@ -11,7 +11,6 @@ |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| -#include "remoting/protocol/authentication_method.h" |
| #include "remoting/protocol/authenticator.h" |
| #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| @@ -60,6 +59,15 @@ namespace protocol { |
| // mix of webapp, client plugin and host, for both Me2Me and IT2Me. |
| class NegotiatingAuthenticatorBase : public Authenticator { |
| public: |
| + // Method represents an authentication algorithm. |
| + enum class Method { |
| + INVALID, |
| + SPAKE2_SHARED_SECRET_PLAIN, |
|
Jamie
2016/03/08 02:17:38
Unrelated to this CL, but when do we use PLAIN, an
Sergey Ulanov
2016/03/08 18:32:40
It's used for It2Me. It can potentially be switche
|
| + SPAKE2_SHARED_SECRET_HMAC, |
| + SPAKE2_PAIR, |
| + THIRD_PARTY, |
| + }; |
| + |
| ~NegotiatingAuthenticatorBase() override; |
| // Authenticator interface. |
| @@ -74,18 +82,23 @@ class NegotiatingAuthenticatorBase : public Authenticator { |
| void ProcessMessageInternal(const buzz::XmlElement* message, |
| const base::Closure& resume_callback); |
| - const AuthenticationMethod& current_method_for_testing() const { |
| - return current_method_; |
| - } |
| - |
| protected: |
| + friend class NegotiatingAuthenticatorTest; |
|
Jamie
2016/03/08 02:17:38
FRIEND_TEST_ALL_PREFIXES?
Sergey Ulanov
2016/03/08 18:32:40
FRIEND_TEST_ALL_PREFIXES is used to friend specifi
|
| + |
| static const buzz::StaticQName kMethodAttributeQName; |
| static const buzz::StaticQName kSupportedMethodsAttributeQName; |
| static const char kSupportedMethodsSeparator; |
| + // Parses a string that defines an authentication method. Returns |
| + // Method::INVALID if the string is invalid. |
| + static Method ParseMethodString(const std::string& value); |
| + |
| + // Returns string representation of |method|. |
| + static std::string MethodToString(Method method); |
| + |
| explicit NegotiatingAuthenticatorBase(Authenticator::State initial_state); |
| - void AddMethod(AuthenticationMethod method); |
| + void AddMethod(Method method); |
| // Updates |state_| to reflect the current underlying authenticator state. |
| // |resume_callback| is called after the state is updated. |
| @@ -95,8 +108,8 @@ class NegotiatingAuthenticatorBase : public Authenticator { |
| // the 'method' tag with |current_method_|. |
| virtual scoped_ptr<buzz::XmlElement> GetNextMessageInternal(); |
| - std::vector<AuthenticationMethod> methods_; |
| - AuthenticationMethod current_method_ = AuthenticationMethod::INVALID; |
| + std::vector<Method> methods_; |
| + Method current_method_ = Method::INVALID; |
| scoped_ptr<Authenticator> current_authenticator_; |
| State state_; |
| RejectionReason rejection_reason_ = INVALID_CREDENTIALS; |