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

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

Issue 2443903004: Add xmllite and xmpp sources to third_party/ (Closed)
Patch Set: Fix GN and sort includes Created 3 years, 12 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 // Copyright 2004 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBRTC_LIBJINGLE_XMPP_SASLPLAINMECHANISM_H_
6 #define WEBRTC_LIBJINGLE_XMPP_SASLPLAINMECHANISM_H_
7
8 #include "third_party/libjingle_xmpp/xmpp/saslmechanism.h"
9 #include "webrtc/base/cryptstring.h"
10
11 namespace buzz {
12
13 class SaslPlainMechanism : public SaslMechanism {
14
15 public:
16 SaslPlainMechanism(const buzz::Jid user_jid, const rtc::CryptString & password ) :
17 user_jid_(user_jid), password_(password) {}
18
19 virtual std::string GetMechanismName() { return "PLAIN"; }
20
21 virtual XmlElement * StartSaslAuth() {
22 // send initial request
23 XmlElement * el = new XmlElement(QN_SASL_AUTH, true);
24 el->AddAttr(QN_MECHANISM, "PLAIN");
25
26 rtc::FormatCryptString credential;
27 credential.Append("\0", 1);
28 credential.Append(user_jid_.node());
29 credential.Append("\0", 1);
30 credential.Append(&password_);
31 el->AddText(Base64EncodeFromArray(credential.GetData(), credential.GetLength ()));
32 return el;
33 }
34
35 private:
36 Jid user_jid_;
37 rtc::CryptString password_;
38 };
39
40 }
41
42 #endif // WEBRTC_LIBJINGLE_XMPP_SASLPLAINMECHANISM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698