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

Side by Side Diff: third_party/libjingle_xmpp/xmpp/saslcookiemechanism.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_SASLCOOKIEMECHANISM_H_
12 #define WEBRTC_LIBJINGLE_XMPP_SASLCOOKIEMECHANISM_H_
13
14 #include "third_party/libjingle_xmpp/xmllite/qname.h"
15 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
16 #include "third_party/libjingle_xmpp/xmpp/constants.h"
17 #include "third_party/libjingle_xmpp/xmpp/saslmechanism.h"
18
19 namespace buzz {
20
21 class SaslCookieMechanism : public SaslMechanism {
22
23 public:
24 SaslCookieMechanism(const std::string & mechanism,
25 const std::string & username,
26 const std::string & cookie,
27 const std::string & token_service)
28 : mechanism_(mechanism),
29 username_(username),
30 cookie_(cookie),
31 token_service_(token_service) {}
32
33 SaslCookieMechanism(const std::string & mechanism,
34 const std::string & username,
35 const std::string & cookie)
36 : mechanism_(mechanism),
37 username_(username),
38 cookie_(cookie),
39 token_service_("") {}
40
41 virtual std::string GetMechanismName() { return mechanism_; }
42
43 virtual XmlElement * StartSaslAuth() {
44 // send initial request
45 XmlElement * el = new XmlElement(QN_SASL_AUTH, true);
46 el->AddAttr(QN_MECHANISM, mechanism_);
47 if (!token_service_.empty()) {
48 el->AddAttr(QN_GOOGLE_AUTH_SERVICE, token_service_);
49 }
50
51 std::string credential;
52 credential.append("\0", 1);
53 credential.append(username_);
54 credential.append("\0", 1);
55 credential.append(cookie_);
56 el->AddText(Base64Encode(credential));
57 return el;
58 }
59
60 private:
61 std::string mechanism_;
62 std::string username_;
63 std::string cookie_;
64 std::string token_service_;
65 };
66
67 }
68
69 #endif // WEBRTC_LIBJINGLE_XMPP_SASLCOOKIEMECHANISM_H_
OLDNEW
« no previous file with comments | « third_party/libjingle_xmpp/xmpp/prexmppauth.h ('k') | third_party/libjingle_xmpp/xmpp/saslhandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698