| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_LIBJINGLE_XMPP_PLAINSASLHANDLER_H_ | 11 #ifndef WEBRTC_LIBJINGLE_XMPP_PLAINSASLHANDLER_H_ |
| 12 #define WEBRTC_LIBJINGLE_XMPP_PLAINSASLHANDLER_H_ | 12 #define WEBRTC_LIBJINGLE_XMPP_PLAINSASLHANDLER_H_ |
| 13 | 13 |
| 14 #include <algorithm> | 14 #include <algorithm> |
| 15 #include "third_party/libjingle_xmpp/xmpp/saslhandler.h" | 15 #include "third_party/libjingle_xmpp/xmpp/saslhandler.h" |
| 16 #include "third_party/libjingle_xmpp/xmpp/saslplainmechanism.h" | 16 #include "third_party/libjingle_xmpp/xmpp/saslplainmechanism.h" |
| 17 #include "third_party/webrtc/base/cryptstring.h" | |
| 18 | 17 |
| 19 namespace buzz { | 18 namespace buzz { |
| 20 | 19 |
| 21 class PlainSaslHandler : public SaslHandler { | 20 class PlainSaslHandler : public SaslHandler { |
| 22 public: | 21 public: |
| 23 PlainSaslHandler(const Jid & jid, const rtc::CryptString & password, | 22 PlainSaslHandler(const Jid & jid, const std::string & password, |
| 24 bool allow_plain) : jid_(jid), password_(password), | 23 bool allow_plain) : jid_(jid), password_(password), |
| 25 allow_plain_(allow_plain) {} | 24 allow_plain_(allow_plain) {} |
| 26 | 25 |
| 27 virtual ~PlainSaslHandler() {} | 26 virtual ~PlainSaslHandler() {} |
| 28 | 27 |
| 29 // Should pick the best method according to this handler | 28 // Should pick the best method according to this handler |
| 30 // returns the empty string if none are suitable | 29 // returns the empty string if none are suitable |
| 31 virtual std::string ChooseBestSaslMechanism(const std::vector<std::string> & m
echanisms, bool encrypted) { | 30 virtual std::string ChooseBestSaslMechanism(const std::vector<std::string> & m
echanisms, bool encrypted) { |
| 32 | 31 |
| 33 if (!encrypted && !allow_plain_) { | 32 if (!encrypted && !allow_plain_) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 // once you get it). If not handled, return NULL. | 46 // once you get it). If not handled, return NULL. |
| 48 virtual SaslMechanism * CreateSaslMechanism(const std::string & mechanism) { | 47 virtual SaslMechanism * CreateSaslMechanism(const std::string & mechanism) { |
| 49 if (mechanism == "PLAIN") { | 48 if (mechanism == "PLAIN") { |
| 50 return new SaslPlainMechanism(jid_, password_); | 49 return new SaslPlainMechanism(jid_, password_); |
| 51 } | 50 } |
| 52 return NULL; | 51 return NULL; |
| 53 } | 52 } |
| 54 | 53 |
| 55 private: | 54 private: |
| 56 Jid jid_; | 55 Jid jid_; |
| 57 rtc::CryptString password_; | 56 std::string password_; |
| 58 bool allow_plain_; | 57 bool allow_plain_; |
| 59 }; | 58 }; |
| 60 | 59 |
| 61 | 60 |
| 62 } | 61 } |
| 63 | 62 |
| 64 #endif // WEBRTC_LIBJINGLE_XMPP_PLAINSASLHANDLER_H_ | 63 #endif // WEBRTC_LIBJINGLE_XMPP_PLAINSASLHANDLER_H_ |
| OLD | NEW |