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

Side by Side Diff: sync/tools/testserver/xmppserver.py

Issue 15421011: Use OAuth2 token for sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 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
« no previous file with comments | « sync/tools/sync_client.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """A bare-bones and non-compliant XMPP server. 5 """A bare-bones and non-compliant XMPP server.
6 6
7 Just enough of the protocol is implemented to get it to work with 7 Just enough of the protocol is implemented to get it to work with
8 Chrome's sync notification system. 8 Chrome's sync notification system.
9 """ 9 """
10 10
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 '<stream:stream from="%s" id="%s" ' 206 '<stream:stream from="%s" id="%s" '
207 'version="1.0" xmlns:stream="http://etherx.jabber.org/streams" ' 207 'version="1.0" xmlns:stream="http://etherx.jabber.org/streams" '
208 'xmlns="jabber:client">') 208 'xmlns="jabber:client">')
209 209
210 # Used when in the _INITIAL_STREAM_NEEDED state. 210 # Used when in the _INITIAL_STREAM_NEEDED state.
211 _AUTH_STANZA = ParseXml( 211 _AUTH_STANZA = ParseXml(
212 '<stream:features xmlns:stream="http://etherx.jabber.org/streams">' 212 '<stream:features xmlns:stream="http://etherx.jabber.org/streams">'
213 ' <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">' 213 ' <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">'
214 ' <mechanism>PLAIN</mechanism>' 214 ' <mechanism>PLAIN</mechanism>'
215 ' <mechanism>X-GOOGLE-TOKEN</mechanism>' 215 ' <mechanism>X-GOOGLE-TOKEN</mechanism>'
216 ' <mechanism>X-OAUTH2</mechanism>'
216 ' </mechanisms>' 217 ' </mechanisms>'
217 '</stream:features>') 218 '</stream:features>')
218 219
219 # Used when in the _AUTH_NEEDED state. 220 # Used when in the _AUTH_NEEDED state.
220 _AUTH_SUCCESS_STANZA = ParseXml( 221 _AUTH_SUCCESS_STANZA = ParseXml(
221 '<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>') 222 '<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>')
222 223
223 # Used when in the _AUTH_NEEDED state. 224 # Used when in the _AUTH_NEEDED state.
224 _AUTH_FAILURE_STANZA = ParseXml( 225 _AUTH_FAILURE_STANZA = ParseXml(
225 '<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>') 226 '<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>')
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 self._connections.discard(xmpp_connection) 586 self._connections.discard(xmpp_connection)
586 self._handshake_done_connections.discard(xmpp_connection) 587 self._handshake_done_connections.discard(xmpp_connection)
587 588
588 def ForwardNotification(self, unused_xmpp_connection, notification_stanza): 589 def ForwardNotification(self, unused_xmpp_connection, notification_stanza):
589 if self._notifications_enabled: 590 if self._notifications_enabled:
590 for connection in self._handshake_done_connections: 591 for connection in self._handshake_done_connections:
591 print 'Sending notification to %s' % connection 592 print 'Sending notification to %s' % connection
592 connection.ForwardNotification(notification_stanza) 593 connection.ForwardNotification(notification_stanza)
593 else: 594 else:
594 print 'Notifications disabled; dropping notification' 595 print 'Notifications disabled; dropping notification'
OLDNEW
« no previous file with comments | « sync/tools/sync_client.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698