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

Side by Side Diff: third_party/libjingle_xmpp/xmpp/saslplainmechanism.h

Issue 2443903004: Add xmllite and xmpp sources to third_party/ (Closed)
Patch Set: Explicitly use webrtc_overrides/webrtc/base/logging.h Created 3 years, 11 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
(Empty)
1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_LIBJINGLE_XMPP_SASLPLAINMECHANISM_H_
12 #define WEBRTC_LIBJINGLE_XMPP_SASLPLAINMECHANISM_H_
13
14 #include "third_party/libjingle_xmpp/xmpp/saslmechanism.h"
15 #include "third_party/webrtc/base/cryptstring.h"
16
17 namespace buzz {
18
19 class SaslPlainMechanism : public SaslMechanism {
20
21 public:
22 SaslPlainMechanism(const buzz::Jid user_jid, const rtc::CryptString & password ) :
23 user_jid_(user_jid), password_(password) {}
24
25 virtual std::string GetMechanismName() { return "PLAIN"; }
26
27 virtual XmlElement * StartSaslAuth() {
28 // send initial request
29 XmlElement * el = new XmlElement(QN_SASL_AUTH, true);
30 el->AddAttr(QN_MECHANISM, "PLAIN");
31
32 rtc::FormatCryptString credential;
33 credential.Append("\0", 1);
34 credential.Append(user_jid_.node());
35 credential.Append("\0", 1);
36 credential.Append(&password_);
37 el->AddText(Base64EncodeFromArray(credential.GetData(), credential.GetLength ()));
38 return el;
39 }
40
41 private:
42 Jid user_jid_;
43 rtc::CryptString password_;
44 };
45
46 }
47
48 #endif // WEBRTC_LIBJINGLE_XMPP_SASLPLAINMECHANISM_H_
OLDNEW
« no previous file with comments | « third_party/libjingle_xmpp/xmpp/saslmechanism.cc ('k') | third_party/libjingle_xmpp/xmpp/util_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698