Merge lp:~dobey/ubuntuone-client/system-oauth into lp:ubuntuone-client

Proposed by dobey
Status: Merged
Approved by: Rick McBride
Approved revision: 201
Merged at revision: not available
Proposed branch: lp:~dobey/ubuntuone-client/system-oauth
Merge into: lp:ubuntuone-client
Diff against target: None lines
To merge this branch: bzr merge lp:~dobey/ubuntuone-client/system-oauth
Reviewer Review Type Date Requested Status
Rick McBride (community) Approve
Nicola Larosa (community) Approve
Review via email: mp+11393@code.launchpad.net

Commit message

Send callback with request instead of authorization, for 1.0a
Use system python-oauth

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

This implements 1.0a and uses the python-oauth library in the client. Needs a version of the server that implements 1.0a to be deployed to be useful, though, otherwise it will break.

Revision history for this message
Nicola Larosa (teknico) wrote :

Tests pass, code looks good.

review: Approve
Revision history for this message
Rick McBride (rmcbride) wrote :

Very nice.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/oauthdesktop/test_auth.py'
2--- tests/oauthdesktop/test_auth.py 2009-07-15 15:05:24 +0000
3+++ tests/oauthdesktop/test_auth.py 2009-09-08 20:14:06 +0000
4@@ -21,7 +21,7 @@
5 from contrib.mocker import ANY, IN, MockerTestCase
6 import testresources
7
8-from ubuntuone.storageprotocol import oauth
9+from oauth import oauth
10 from ubuntuone.oauthdesktop.auth import (AuthorisationClient,
11 NoAccessToken)
12
13
14=== modified file 'ubuntuone/oauthdesktop/auth.py'
15--- ubuntuone/oauthdesktop/auth.py 2009-07-24 19:00:41 +0000
16+++ ubuntuone/oauthdesktop/auth.py 2009-09-08 20:14:06 +0000
17@@ -31,7 +31,7 @@
18 import os
19
20 import gnomekeyring
21-from ubuntuone.storageprotocol import oauth
22+from oauth import oauth
23 from ubuntuone.oauthdesktop.key_acls import set_all_key_acls
24
25 from twisted.internet import reactor
26@@ -285,7 +285,16 @@
27 parameters = {}
28 if description:
29 parameters['description'] = description
30+ # Add a nonce to the query so we know the callback (to our temp
31+ # webserver) came from us
32+ nonce = random.randint(1000000, 10000000)
33+
34+ # start temporary webserver to receive browser response
35+ callback_url = self.get_temporary_httpd(nonce,
36+ self.retrieve_access_token, store)
37+
38 oauth_request = oauth.OAuthRequest.from_consumer_and_token(
39+ callback=callback_url,
40 http_url=self.request_token_url,
41 oauth_consumer=self.consumer,
42 parameters=parameters)
43@@ -294,17 +303,9 @@
44 self.request_token = self.make_token_request(oauth_request)
45
46 # Request authorisation from the user
47- # Add a nonce to the query so we know the callback (to our temp
48- # webserver) came from us
49- nonce = random.randint(1000000, 10000000)
50-
51- # start temporary webserver to receive browser response
52- callback_url = self.get_temporary_httpd(nonce,
53- self.retrieve_access_token, store)
54 oauth_request = oauth.OAuthRequest.from_token_and_callback(
55 http_url=self.user_authorisation_url,
56- token=self.request_token,
57- callback=callback_url)
58+ token=self.request_token)
59 nodename = os.uname()[1]
60 if nodename:
61 oauth_request.set_parameter("description", nodename)
62
63=== modified file 'ubuntuone/syncdaemon/action_queue.py'
64--- ubuntuone/syncdaemon/action_queue.py 2009-09-01 19:16:10 +0000
65+++ ubuntuone/syncdaemon/action_queue.py 2009-09-08 20:14:06 +0000
66@@ -42,7 +42,7 @@
67 from urllib2 import urlopen, Request, HTTPError
68 from twisted.internet import threads
69
70-from ubuntuone.storageprotocol import oauth
71+from oauth import oauth
72 from ubuntuone.storageprotocol.context import get_ssl_context
73 from ubuntuone.storageprotocol import protocol_pb2
74 from ubuntuone.storageprotocol.client import ThrottlingStorageClient, \
75
76=== modified file 'ubuntuone/syncdaemon/main.py'
77--- ubuntuone/syncdaemon/main.py 2009-09-02 18:27:01 +0000
78+++ ubuntuone/syncdaemon/main.py 2009-09-08 20:14:06 +0000
79@@ -26,7 +26,7 @@
80
81 from twisted.internet import defer, reactor, task
82
83-from ubuntuone.storageprotocol import oauth
84+from oauth import oauth
85 from ubuntuone.syncdaemon import (
86 action_queue,
87 dbus_interface,
88
89=== modified file 'ubuntuone/u1sync/client.py'
90--- ubuntuone/u1sync/client.py 2009-08-19 17:00:58 +0000
91+++ ubuntuone/u1sync/client.py 2009-09-08 20:14:06 +0000
92@@ -44,7 +44,7 @@
93
94 CONSUMER_KEY = "ubuntuone"
95
96-from ubuntuone.storageprotocol.oauth import OAuthConsumer
97+from oauth.oauth import OAuthConsumer
98 from ubuntuone.storageprotocol.client import (
99 StorageClientFactory, StorageClient)
100 from ubuntuone.storageprotocol import request
101
102=== modified file 'ubuntuone/u1sync/main.py'
103--- ubuntuone/u1sync/main.py 2009-08-18 20:13:43 +0000
104+++ ubuntuone/u1sync/main.py 2009-09-08 20:14:06 +0000
105@@ -35,7 +35,7 @@
106 from twisted.internet import reactor
107 from Queue import Queue
108
109-from ubuntuone.storageprotocol.oauth import OAuthToken
110+from oauth.oauth import OAuthToken
111 import ubuntuone.storageprotocol.dircontent_pb2 as dircontent_pb2
112 from ubuntuone.storageprotocol.dircontent_pb2 import DIRECTORY, SYMLINK
113 from ubuntuone.u1sync.genericmerge import (

Subscribers

People subscribed via source and target branches