Merge lp:~mardy/account-plugins/mcloud-plugin-lp1587282 into lp:~gary-wzl77/account-plugins/mcloud-plugin-lp1587282
- mcloud-plugin-lp1587282
- Merge into mcloud-plugin-lp1587282
Status: | Needs review | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~mardy/account-plugins/mcloud-plugin-lp1587282 | ||||
Merge into: | lp:~gary-wzl77/account-plugins/mcloud-plugin-lp1587282 | ||||
Diff against target: |
1210 lines (+351/-510) 27 files modified
.bzrignore (+5/-0) Makefile.am (+26/-6) configure.ac (+4/-1) data/providers/facebook.provider.in.in (+1/-1) data/providers/flickr.provider.in.in (+1/-1) data/providers/mcloud.provider.in.in (+4/-5) data/providers/twitter.provider.in.in (+1/-1) data/webkit-options/api.twitter.com.conf (+0/-2) data/webkit-options/login.yahoo.com.conf (+0/-2) data/webkit-options/www.facebook.com.conf (+0/-7) debian/account-plugin-facebook.install (+0/-1) debian/account-plugin-flickr.install (+0/-1) debian/account-plugin-twitter.install (+0/-1) debian/changelog (+34/-0) debian/control (+73/-52) debian/libaccount-plugin-facebook.install (+1/-0) debian/libaccount-plugin-flickr.install (+1/-0) debian/libaccount-plugin-twitter.install (+1/-0) qml/Makefile.am (+1/-0) qml/mcloud/ErrorItem.qml (+0/-48) qml/mcloud/Main.qml (+2/-3) qml/mcloud/OAuth.qml (+0/-283) qml/mcloud/WebView.qml (+0/-94) src/facebook.vala (+69/-0) src/flickr.vala (+41/-0) src/google.vala (+40/-1) src/twitter.vala (+46/-0) |
||||
To merge this branch: | bzr merge lp:~mardy/account-plugins/mcloud-plugin-lp1587282 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary.Wang | Approve | ||
Review via email: mp+296288@code.launchpad.net |
Commit message
Description of the change
Use the web based flow for authentication
- 165. By Alberto Mardegan
-
Enable state parameter
Alberto Mardegan (mardy) wrote : | # |
> I'd like to test it on my side with my phone, could you please give me the
> silo number for accounts-
> after you finish verification.
That will probably take some days, as I still need people to review the upstream changes.
But I've uploaded the package to my personal PPA here:
https:/
While I'm writing this the signon-plugin-oauth is still building on armhf, but it should be ready soon.
Gary.Wang (gary-wzl77) wrote : | # |
I install latest signon-plugin-oauth package (armhf) on my device from your PPA , and run several tests. Mcloud scopes and camera app with mcloud integration both works very well.
Thanks mandy.
So let's wait for signon-plugin-oauth upstream review.
Alberto Mardegan (mardy) wrote : | # |
Upstream review was faster than expected. I've put the OAuth plugin in silo 59, the CI ticket is this one:
https:/
If you don't have objections, I will also take this branch and put it in the same silo, so that it will be easier to test.
Gary.Wang (gary-wzl77) wrote : | # |
That's so nice.
No problem.
Thanks.
- 166. By Alberto Mardegan
-
Merge from trunk
* debian/control:
Update package descriptions for all account plugins (LP: #1590786)
[ Alberto Mardegan ]
* Add account plugin for vk.com (LP: #1564883)
* Add ownCloud plugin (LP: #1570986)
[ Alberto Mardegan ]
* After the authentication, retrieve the username in Google, Facebook,
Flickr and Twitter plugins (LP: #1565772)
* debian/control, debian/libaccount- plugin- facebook. install,
debian/libaccount- plugin- flickr. install,
debian/libaccount- plugin- twitter. install:
add packages containing plugin modules.
* debian/account- plugin- facebook. install,
debian/account- plugin- flickr. install,
debian/account- plugin- twitter. install:
remove unneeded webkit-options files.
[ CI Train Bot ]
* No-change rebuild. - 167. By Alberto Mardegan
-
Update description
Unmerged revisions
- 167. By Alberto Mardegan
-
Update description
- 166. By Alberto Mardegan
-
Merge from trunk
* debian/control:
Update package descriptions for all account plugins (LP: #1590786)
[ Alberto Mardegan ]
* Add account plugin for vk.com (LP: #1564883)
* Add ownCloud plugin (LP: #1570986)
[ Alberto Mardegan ]
* After the authentication, retrieve the username in Google, Facebook,
Flickr and Twitter plugins (LP: #1565772)
* debian/control, debian/libaccount- plugin- facebook. install,
debian/libaccount- plugin- flickr. install,
debian/libaccount- plugin- twitter. install:
add packages containing plugin modules.
* debian/account- plugin- facebook. install,
debian/account- plugin- flickr. install,
debian/account- plugin- twitter. install:
remove unneeded webkit-options files.
[ CI Train Bot ]
* No-change rebuild. - 165. By Alberto Mardegan
-
Enable state parameter
- 164. By Alberto Mardegan
-
Change token path
- 163. By Alberto Mardegan
-
Use web_server mechanism
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2016-05-31 08:53:33 +0000 | |||
3 | +++ .bzrignore 2016-06-16 11:50:25 +0000 | |||
4 | @@ -6,6 +6,7 @@ | |||
5 | 6 | *.service | 6 | *.service |
6 | 7 | *.substvars | 7 | *.substvars |
7 | 8 | *.stamp | 8 | *.stamp |
8 | 9 | *.trs | ||
9 | 9 | INSTALL | 10 | INSTALL |
10 | 10 | Makefile | 11 | Makefile |
11 | 11 | Makefile.in | 12 | Makefile.in |
12 | @@ -53,7 +54,11 @@ | |||
13 | 53 | .deps | 54 | .deps |
14 | 54 | .dirstamp | 55 | .dirstamp |
15 | 55 | .libs | 56 | .libs |
16 | 57 | /src/facebook.c | ||
17 | 58 | /src/flickr.c | ||
18 | 56 | /src/generic-oauth.c | 59 | /src/generic-oauth.c |
19 | 57 | /src/google.c | 60 | /src/google.c |
20 | 61 | /src/twitter.c | ||
21 | 62 | /test-driver | ||
22 | 58 | /test-provider | 63 | /test-provider |
23 | 59 | /test-service | 64 | /test-service |
24 | 60 | 65 | ||
25 | === modified file 'Makefile.am' | |||
26 | --- Makefile.am 2016-05-31 08:53:33 +0000 | |||
27 | +++ Makefile.am 2016-06-16 11:50:25 +0000 | |||
28 | @@ -8,8 +8,11 @@ | |||
29 | 8 | if ENABLE_LIBACCOUNT_PLUGIN | 8 | if ENABLE_LIBACCOUNT_PLUGIN |
30 | 9 | # Binary account plugins. | 9 | # Binary account plugins. |
31 | 10 | plugin_LTLIBRARIES = \ | 10 | plugin_LTLIBRARIES = \ |
32 | 11 | libfacebook.la \ | ||
33 | 12 | libflickr.la \ | ||
34 | 11 | libgeneric-oauth.la \ | 13 | libgeneric-oauth.la \ |
36 | 12 | libgoogle.la | 14 | libgoogle.la \ |
37 | 15 | libtwitter.la | ||
38 | 13 | 16 | ||
39 | 14 | VALAFLAGS = \ | 17 | VALAFLAGS = \ |
40 | 15 | --vapidir $(top_srcdir)/src \ | 18 | --vapidir $(top_srcdir)/src \ |
41 | @@ -36,12 +39,32 @@ | |||
42 | 36 | -no-undefined \ | 39 | -no-undefined \ |
43 | 37 | -export-symbols-regex '^ap_module_get_object_type' | 40 | -export-symbols-regex '^ap_module_get_object_type' |
44 | 38 | 41 | ||
47 | 39 | libgoogle_la_CPPFLAGS = $(plugin_cppflags) | 42 | libfacebook_la_CPPFLAGS = $(plugin_cppflags) $(RESTAPIS_CFLAGS) |
48 | 40 | libgoogle_la_LIBADD = $(plugin_libadd) | 43 | libfacebook_la_LIBADD = $(plugin_libadd) $(RESTAPIS_LIBS) |
49 | 44 | libfacebook_la_LDFLAGS = $(plugin_ldflags) | ||
50 | 45 | libfacebook_la_VALAFLAGS = --pkg libsoup-2.4 --pkg json-glib-1.0 | ||
51 | 46 | libfacebook_la_SOURCES = \ | ||
52 | 47 | src/facebook.vala | ||
53 | 48 | |||
54 | 49 | libflickr_la_CPPFLAGS = $(plugin_cppflags) | ||
55 | 50 | libflickr_la_LIBADD = $(plugin_libadd) | ||
56 | 51 | libflickr_la_LDFLAGS = $(plugin_ldflags) | ||
57 | 52 | libflickr_la_SOURCES = \ | ||
58 | 53 | src/flickr.vala | ||
59 | 54 | |||
60 | 55 | libgoogle_la_CPPFLAGS = $(plugin_cppflags) $(RESTAPIS_CFLAGS) | ||
61 | 56 | libgoogle_la_LIBADD = $(plugin_libadd) $(RESTAPIS_LIBS) | ||
62 | 41 | libgoogle_la_LDFLAGS = $(plugin_ldflags) | 57 | libgoogle_la_LDFLAGS = $(plugin_ldflags) |
63 | 58 | libgoogle_la_VALAFLAGS = --pkg libsoup-2.4 --pkg json-glib-1.0 | ||
64 | 42 | libgoogle_la_SOURCES = \ | 59 | libgoogle_la_SOURCES = \ |
65 | 43 | src/google.vala | 60 | src/google.vala |
66 | 44 | 61 | ||
67 | 62 | libtwitter_la_CPPFLAGS = $(plugin_cppflags) | ||
68 | 63 | libtwitter_la_LIBADD = $(plugin_libadd) | ||
69 | 64 | libtwitter_la_LDFLAGS = $(plugin_ldflags) | ||
70 | 65 | libtwitter_la_SOURCES = \ | ||
71 | 66 | src/twitter.vala | ||
72 | 67 | |||
73 | 45 | libgeneric_oauth_la_CPPFLAGS = $(plugin_cppflags) | 68 | libgeneric_oauth_la_CPPFLAGS = $(plugin_cppflags) |
74 | 46 | libgeneric_oauth_la_LIBADD = $(plugin_libadd) | 69 | libgeneric_oauth_la_LIBADD = $(plugin_libadd) |
75 | 47 | libgeneric_oauth_la_LDFLAGS = $(plugin_ldflags) | 70 | libgeneric_oauth_la_LDFLAGS = $(plugin_ldflags) |
76 | @@ -107,12 +130,9 @@ | |||
77 | 107 | data/webkit-options/api.instagram.com.conf \ | 130 | data/webkit-options/api.instagram.com.conf \ |
78 | 108 | data/webkit-options/api.weibo.com.conf \ | 131 | data/webkit-options/api.weibo.com.conf \ |
79 | 109 | data/webkit-options/api.t.sohu.com.conf \ | 132 | data/webkit-options/api.t.sohu.com.conf \ |
80 | 110 | data/webkit-options/api.twitter.com.conf \ | ||
81 | 111 | data/webkit-options/foursquare.com.conf \ | 133 | data/webkit-options/foursquare.com.conf \ |
82 | 112 | data/webkit-options/identi.ca.conf \ | 134 | data/webkit-options/identi.ca.conf \ |
83 | 113 | data/webkit-options/login.live.com.conf \ | 135 | data/webkit-options/login.live.com.conf \ |
84 | 114 | data/webkit-options/login.yahoo.com.conf \ | ||
85 | 115 | data/webkit-options/www.facebook.com.conf \ | ||
86 | 116 | data/webkit-options/www.linkedin.com.conf | 136 | data/webkit-options/www.linkedin.com.conf |
87 | 117 | 137 | ||
88 | 118 | # Temporary until these bugs are fixed: | 138 | # Temporary until these bugs are fixed: |
89 | 119 | 139 | ||
90 | === modified file 'configure.ac' | |||
91 | --- configure.ac 2016-05-31 08:53:33 +0000 | |||
92 | +++ configure.ac 2016-06-16 11:50:25 +0000 | |||
93 | @@ -41,7 +41,10 @@ | |||
94 | 41 | [have_libaccount_plugin=no]) | 41 | [have_libaccount_plugin=no]) |
95 | 42 | 42 | ||
96 | 43 | AS_IF([test "x$have_libaccount_plugin" = "xyes"], | 43 | AS_IF([test "x$have_libaccount_plugin" = "xyes"], |
98 | 44 | [PKG_CHECK_MODULES([ACCOUNT_PLUGINS], [account-plugin >= 0.1.3])], | 44 | [ |
99 | 45 | PKG_CHECK_MODULES([ACCOUNT_PLUGINS], [account-plugin >= 0.1.3]) | ||
100 | 46 | PKG_CHECK_MODULES([RESTAPIS], [libsoup-2.4 json-glib-1.0]) | ||
101 | 47 | ], | ||
102 | 45 | [AS_IF([test "x$enable_libaccount_plugin" = "xyes"], | 48 | [AS_IF([test "x$enable_libaccount_plugin" = "xyes"], |
103 | 46 | [AC_MSG_ERROR([libaccount-plugin support enabled but required dependencies were not found])])]) | 49 | [AC_MSG_ERROR([libaccount-plugin support enabled but required dependencies were not found])])]) |
104 | 47 | 50 | ||
105 | 48 | 51 | ||
106 | === modified file 'data/providers/facebook.provider.in.in' | |||
107 | --- data/providers/facebook.provider.in.in 2015-09-09 08:48:32 +0000 | |||
108 | +++ data/providers/facebook.provider.in.in 2016-06-16 11:50:25 +0000 | |||
109 | @@ -4,7 +4,7 @@ | |||
110 | 4 | <icon>facebook</icon> | 4 | <icon>facebook</icon> |
111 | 5 | <translations>account-plugins</translations> | 5 | <translations>account-plugins</translations> |
112 | 6 | <domains>.*facebook\.com</domains> | 6 | <domains>.*facebook\.com</domains> |
114 | 7 | <plugin>generic-oauth</plugin> | 7 | <plugin>facebook</plugin> |
115 | 8 | <single-account>true</single-account> | 8 | <single-account>true</single-account> |
116 | 9 | 9 | ||
117 | 10 | <template> | 10 | <template> |
118 | 11 | 11 | ||
119 | === modified file 'data/providers/flickr.provider.in.in' | |||
120 | --- data/providers/flickr.provider.in.in 2013-02-25 06:25:34 +0000 | |||
121 | +++ data/providers/flickr.provider.in.in 2016-06-16 11:50:25 +0000 | |||
122 | @@ -4,7 +4,7 @@ | |||
123 | 4 | <icon>flickr</icon> | 4 | <icon>flickr</icon> |
124 | 5 | <translations>account-plugins</translations> | 5 | <translations>account-plugins</translations> |
125 | 6 | <domains>.*flickr\.com</domains> | 6 | <domains>.*flickr\.com</domains> |
127 | 7 | <plugin>generic-oauth</plugin> | 7 | <plugin>flickr</plugin> |
128 | 8 | 8 | ||
129 | 9 | <template> | 9 | <template> |
130 | 10 | <group name="auth"> | 10 | <group name="auth"> |
131 | 11 | 11 | ||
132 | === modified file 'data/providers/mcloud.provider.in.in' | |||
133 | --- data/providers/mcloud.provider.in.in 2016-05-31 08:53:33 +0000 | |||
134 | +++ data/providers/mcloud.provider.in.in 2016-06-16 11:50:25 +0000 | |||
135 | @@ -9,18 +9,17 @@ | |||
136 | 9 | <template> | 9 | <template> |
137 | 10 | <group name="auth"> | 10 | <group name="auth"> |
138 | 11 | <setting name="method">oauth2</setting> | 11 | <setting name="method">oauth2</setting> |
140 | 12 | <setting name="mechanism">user_agent</setting> | 12 | <setting name="mechanism">web_server</setting> |
141 | 13 | <group name="oauth2"> | 13 | <group name="oauth2"> |
143 | 14 | <group name="user_agent"> | 14 | <group name="web_server"> |
144 | 15 | <setting name="Host">caiyun.feixin.10086.cn</setting> | 15 | <setting name="Host">caiyun.feixin.10086.cn</setting> |
145 | 16 | <setting name="AuthPath">authorize.jsp</setting> | 16 | <setting name="AuthPath">authorize.jsp</setting> |
147 | 17 | <setting name="TokenPath">access_token</setting> | 17 | <setting name="TokenPath">https://ose.caiyun.feixin.10086.cn/oauthApp/OAuth2/getToken</setting> |
148 | 18 | <setting name="RedirectUri">http://developer.ubuntu.com/en/</setting> | 18 | <setting name="RedirectUri">http://developer.ubuntu.com/en/</setting> |
149 | 19 | <setting name="ResponseType">code</setting> | 19 | <setting name="ResponseType">code</setting> |
150 | 20 | <setting name="ClientId">@MCLOUD_CLIENT_ID@</setting> | 20 | <setting name="ClientId">@MCLOUD_CLIENT_ID@</setting> |
151 | 21 | <setting name="ClientSecret">@MCLOUD_CLIENT_SECRET@</setting> | ||
152 | 21 | <setting type="as" name="Scope">['nd_cloud']</setting> | 22 | <setting type="as" name="Scope">['nd_cloud']</setting> |
153 | 22 | <setting name="ForceClientAuthViaRequestBody" type="b">true</setting> | ||
154 | 23 | <setting name="DisableStateParameter" type="b">true</setting> | ||
155 | 24 | <setting type="as" name="AllowedSchemes">['https', 'http']</setting> | 23 | <setting type="as" name="AllowedSchemes">['https', 'http']</setting> |
156 | 25 | </group> | 24 | </group> |
157 | 26 | </group> | 25 | </group> |
158 | 27 | 26 | ||
159 | === modified file 'data/providers/twitter.provider.in.in' | |||
160 | --- data/providers/twitter.provider.in.in 2013-02-22 15:17:49 +0000 | |||
161 | +++ data/providers/twitter.provider.in.in 2016-06-16 11:50:25 +0000 | |||
162 | @@ -3,7 +3,7 @@ | |||
163 | 3 | <name>Twitter</name> | 3 | <name>Twitter</name> |
164 | 4 | <icon>twitter</icon> | 4 | <icon>twitter</icon> |
165 | 5 | <translations>account-plugins</translations> | 5 | <translations>account-plugins</translations> |
167 | 6 | <plugin>generic-oauth</plugin> | 6 | <plugin>twitter</plugin> |
168 | 7 | <domains>.*twitter\.com</domains> | 7 | <domains>.*twitter\.com</domains> |
169 | 8 | 8 | ||
170 | 9 | <template> | 9 | <template> |
171 | 10 | 10 | ||
172 | === removed file 'data/webkit-options/api.twitter.com.conf' | |||
173 | --- data/webkit-options/api.twitter.com.conf 2012-06-19 06:08:30 +0000 | |||
174 | +++ data/webkit-options/api.twitter.com.conf 1970-01-01 00:00:00 +0000 | |||
175 | @@ -1,2 +0,0 @@ | |||
176 | 1 | UsernameField = input[id="username_or_email"] | ||
177 | 2 | PasswordField = input[id="password"] | ||
178 | 3 | 0 | ||
179 | === removed file 'data/webkit-options/login.yahoo.com.conf' | |||
180 | --- data/webkit-options/login.yahoo.com.conf 2012-06-18 14:24:03 +0000 | |||
181 | +++ data/webkit-options/login.yahoo.com.conf 1970-01-01 00:00:00 +0000 | |||
182 | @@ -1,2 +0,0 @@ | |||
183 | 1 | UsernameField = input[name="login"] | ||
184 | 2 | PasswordField = input[name="passwd"] | ||
185 | 3 | 0 | ||
186 | === removed file 'data/webkit-options/www.facebook.com.conf' | |||
187 | --- data/webkit-options/www.facebook.com.conf 2012-05-02 22:58:29 +0000 | |||
188 | +++ data/webkit-options/www.facebook.com.conf 1970-01-01 00:00:00 +0000 | |||
189 | @@ -1,7 +0,0 @@ | |||
190 | 1 | ViewportWidth = 420 | ||
191 | 2 | ViewportHeight = 320 | ||
192 | 3 | UsernameField = input[name="email"] | ||
193 | 4 | PasswordField = input[name="pass"] | ||
194 | 5 | #ZoomFactor = 2 | ||
195 | 6 | #PreferredWidth = 420 | ||
196 | 7 | |||
197 | 8 | 0 | ||
198 | === modified file 'debian/account-plugin-facebook.install' | |||
199 | --- debian/account-plugin-facebook.install 2015-04-17 08:53:11 +0000 | |||
200 | +++ debian/account-plugin-facebook.install 2016-06-16 11:50:25 +0000 | |||
201 | @@ -1,4 +1,3 @@ | |||
202 | 1 | etc/signon-ui/webkit-options.d/www.facebook.com.conf | ||
203 | 2 | usr/share/accounts/services/facebook-sharing.service | 1 | usr/share/accounts/services/facebook-sharing.service |
204 | 3 | usr/share/accounts/services/facebook-microblog.service | 2 | usr/share/accounts/services/facebook-microblog.service |
205 | 4 | usr/share/accounts/providers/facebook.provider | 3 | usr/share/accounts/providers/facebook.provider |
206 | 5 | 4 | ||
207 | === modified file 'debian/account-plugin-flickr.install' | |||
208 | --- debian/account-plugin-flickr.install 2014-03-31 08:21:46 +0000 | |||
209 | +++ debian/account-plugin-flickr.install 2016-06-16 11:50:25 +0000 | |||
210 | @@ -1,4 +1,3 @@ | |||
211 | 1 | etc/signon-ui/webkit-options.d/login.yahoo.com.conf | ||
212 | 2 | usr/share/accounts/services/flickr-*.service | 1 | usr/share/accounts/services/flickr-*.service |
213 | 3 | usr/share/accounts/providers/flickr.provider | 2 | usr/share/accounts/providers/flickr.provider |
214 | 4 | usr/share/accounts/qml-plugins/flickr/Main.qml | 3 | usr/share/accounts/qml-plugins/flickr/Main.qml |
215 | 5 | 4 | ||
216 | === modified file 'debian/account-plugin-twitter.install' | |||
217 | --- debian/account-plugin-twitter.install 2013-06-07 11:56:25 +0000 | |||
218 | +++ debian/account-plugin-twitter.install 2016-06-16 11:50:25 +0000 | |||
219 | @@ -1,4 +1,3 @@ | |||
220 | 1 | etc/signon-ui/webkit-options.d/api.twitter.com.conf | ||
221 | 2 | usr/share/accounts/services/twitter-microblog.service | 1 | usr/share/accounts/services/twitter-microblog.service |
222 | 3 | usr/share/accounts/providers/twitter.provider | 2 | usr/share/accounts/providers/twitter.provider |
223 | 4 | usr/share/accounts/qml-plugins/twitter/Main.qml | 3 | usr/share/accounts/qml-plugins/twitter/Main.qml |
224 | 5 | 4 | ||
225 | === modified file 'debian/changelog' | |||
226 | --- debian/changelog 2016-01-26 10:52:41 +0000 | |||
227 | +++ debian/changelog 2016-06-16 11:50:25 +0000 | |||
228 | @@ -1,3 +1,37 @@ | |||
229 | 1 | account-plugins (0.13+16.10.20160614-0ubuntu1) yakkety; urgency=medium | ||
230 | 2 | |||
231 | 3 | * debian/control: | ||
232 | 4 | Update package descriptions for all account plugins (LP: #1590786) | ||
233 | 5 | |||
234 | 6 | -- Alberto Mardegan <mardy@users.sourceforge.net> Tue, 14 Jun 2016 09:07:28 +0000 | ||
235 | 7 | |||
236 | 8 | account-plugins (0.13+16.10.20160608-0ubuntu1) yakkety; urgency=medium | ||
237 | 9 | |||
238 | 10 | [ Alberto Mardegan ] | ||
239 | 11 | * Add account plugin for vk.com (LP: #1564883) | ||
240 | 12 | * Add ownCloud plugin (LP: #1570986) | ||
241 | 13 | |||
242 | 14 | -- David Barth <david.barth@canonical.com> Wed, 08 Jun 2016 12:09:10 +0000 | ||
243 | 15 | |||
244 | 16 | account-plugins (0.13+16.04.20160405-0ubuntu1) xenial; urgency=medium | ||
245 | 17 | |||
246 | 18 | [ Alberto Mardegan ] | ||
247 | 19 | * After the authentication, retrieve the username in Google, Facebook, | ||
248 | 20 | Flickr and Twitter plugins (LP: #1565772) | ||
249 | 21 | * debian/control, debian/libaccount-plugin-facebook.install, | ||
250 | 22 | debian/libaccount-plugin-flickr.install, | ||
251 | 23 | debian/libaccount-plugin-twitter.install: | ||
252 | 24 | add packages containing plugin modules. | ||
253 | 25 | * debian/account-plugin-facebook.install, | ||
254 | 26 | debian/account-plugin-flickr.install, | ||
255 | 27 | debian/account-plugin-twitter.install: | ||
256 | 28 | remove unneeded webkit-options files. | ||
257 | 29 | |||
258 | 30 | [ CI Train Bot ] | ||
259 | 31 | * No-change rebuild. | ||
260 | 32 | |||
261 | 33 | -- David Barth <david.barth@canonical.com> Tue, 05 Apr 2016 12:57:47 +0000 | ||
262 | 34 | |||
263 | 1 | account-plugins (0.12+16.04.20160126-0ubuntu1) xenial; urgency=medium | 35 | account-plugins (0.12+16.04.20160126-0ubuntu1) xenial; urgency=medium |
264 | 2 | 36 | ||
265 | 3 | [ Alberto Mardegan ] | 37 | [ Alberto Mardegan ] |
266 | 4 | 38 | ||
267 | === modified file 'debian/control' | |||
268 | --- debian/control 2016-05-31 08:53:33 +0000 | |||
269 | +++ debian/control 2016-06-16 11:50:25 +0000 | |||
270 | @@ -7,9 +7,11 @@ | |||
271 | 7 | gobject-introspection, | 7 | gobject-introspection, |
272 | 8 | python3, | 8 | python3, |
273 | 9 | pkg-config, | 9 | pkg-config, |
274 | 10 | libaccount-plugin-1.0-dev (>= 0.1.9), | ||
275 | 10 | libaccounts-glib-dev (>= 1.10), | 11 | libaccounts-glib-dev (>= 1.10), |
276 | 12 | libjson-glib-dev, | ||
277 | 11 | libsignon-glib-dev, | 13 | libsignon-glib-dev, |
279 | 12 | libaccount-plugin-1.0-dev (>= 0.1.3), | 14 | libsoup2.4-dev, |
280 | 13 | valac (>= 0.16), | 15 | valac (>= 0.16), |
281 | 14 | gnome-common, | 16 | gnome-common, |
282 | 15 | dh-autoreconf, | 17 | dh-autoreconf, |
283 | @@ -24,125 +26,151 @@ | |||
284 | 24 | Architecture: any | 26 | Architecture: any |
285 | 25 | Depends: ${shlibs:Depends}, ${misc:Depends}, | 27 | Depends: ${shlibs:Depends}, ${misc:Depends}, |
286 | 26 | signon-plugin-oauth2, | 28 | signon-plugin-oauth2, |
293 | 27 | Replaces: account-plugin-generic-oauth (<< 0.10bzr13.04.30) | 29 | Conflicts: account-plugin-windows-live, |
294 | 28 | Breaks: account-plugin-generic-oauth (<< 0.10bzr13.04.30) | 30 | Description: Online account plugin support lib for Unity 7 - generic OAuth |
295 | 29 | Conflicts: account-plugin-generic-oauth (<< 0.10bzr13.04.30), | 31 | Support library for the Unity 7 OAuth-based online account plugins |
290 | 30 | account-plugin-windows-live, | ||
291 | 31 | Description: GNOME Control Center account plugin for single signon - generic OAuth | ||
292 | 32 | GNOME Control Center account plugins for single signon | ||
296 | 33 | 32 | ||
297 | 34 | Package: libaccount-plugin-google | 33 | Package: libaccount-plugin-google |
298 | 35 | Architecture: any | 34 | Architecture: any |
299 | 36 | Depends: ${shlibs:Depends}, ${misc:Depends}, | 35 | Depends: ${shlibs:Depends}, ${misc:Depends}, |
300 | 37 | signon-plugin-oauth2, | 36 | signon-plugin-oauth2, |
306 | 38 | Replaces: account-plugin-google (<< 0.10bzr13.04.30) | 37 | Description: Online account plugin support lib for Unity 7 - Google |
307 | 39 | Breaks: account-plugin-google (<< 0.10bzr13.04.30) | 38 | Support library for the Unity 7 online account plugin |
303 | 40 | Conflicts: account-plugin-google (<< 0.10bzr13.04.30) | ||
304 | 41 | Description: GNOME Control Center account plugin for single signon - Google Auth | ||
305 | 42 | GNOME Control Center account plugins for single signon | ||
308 | 43 | 39 | ||
309 | 44 | Package: account-plugin-google | 40 | Package: account-plugin-google |
310 | 45 | Architecture: all | 41 | Architecture: all |
311 | 46 | Depends: ${shlibs:Depends}, ${misc:Depends}, | 42 | Depends: ${shlibs:Depends}, ${misc:Depends}, |
312 | 47 | libaccount-plugin-google | ubuntu-system-settings-online-accounts, | 43 | libaccount-plugin-google | ubuntu-system-settings-online-accounts, |
313 | 48 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 44 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
316 | 49 | Description: GNOME Control Center account plugin for single signon | 45 | Description: Online account plugin for Unity - Google |
317 | 50 | GNOME Control Center account plugins for single signon | 46 | This plugin adds support for creating Google accounts in the Unity Control |
318 | 47 | Center | ||
319 | 48 | |||
320 | 49 | Package: libaccount-plugin-facebook | ||
321 | 50 | Architecture: any | ||
322 | 51 | Depends: ${shlibs:Depends}, ${misc:Depends}, | ||
323 | 52 | signon-plugin-oauth2, | ||
324 | 53 | Description: Online account plugin support lib for Unity 7 - Facebook | ||
325 | 54 | Support library for the Unity 7 online account plugin | ||
326 | 51 | 55 | ||
327 | 52 | Package: account-plugin-facebook | 56 | Package: account-plugin-facebook |
328 | 53 | Architecture: all | 57 | Architecture: all |
329 | 54 | Depends: ${misc:Depends}, | 58 | Depends: ${misc:Depends}, |
331 | 55 | libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts, | 59 | libaccount-plugin-facebook | ubuntu-system-settings-online-accounts, |
332 | 56 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 60 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
335 | 57 | Description: GNOME Control Center account plugin for single signon - facebook | 61 | Description: Online account plugin for Unity - Facebook |
336 | 58 | GNOME Control Center account plugins for single signon | 62 | This plugin adds support for creating Facebook accounts in the Unity Control |
337 | 63 | Center | ||
338 | 64 | |||
339 | 65 | Package: libaccount-plugin-twitter | ||
340 | 66 | Architecture: any | ||
341 | 67 | Depends: ${shlibs:Depends}, ${misc:Depends}, | ||
342 | 68 | signon-plugin-oauth2, | ||
343 | 69 | Description: Online account plugin support lib for Unity 7 - Twitter | ||
344 | 70 | Support library for the Unity 7 online account plugin | ||
345 | 59 | 71 | ||
346 | 60 | Package: account-plugin-twitter | 72 | Package: account-plugin-twitter |
347 | 61 | Architecture: all | 73 | Architecture: all |
348 | 62 | Depends: ${misc:Depends}, | 74 | Depends: ${misc:Depends}, |
350 | 63 | libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts, | 75 | libaccount-plugin-twitter | ubuntu-system-settings-online-accounts, |
351 | 64 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 76 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
354 | 65 | Description: GNOME Control Center account plugin for single signon - twitter | 77 | Description: Online account plugin for Unity - Twitter |
355 | 66 | GNOME Control Center account plugins for single signon | 78 | This plugin adds support for creating Twitter accounts in the Unity Control |
356 | 79 | Center | ||
357 | 80 | |||
358 | 81 | Package: libaccount-plugin-flickr | ||
359 | 82 | Architecture: any | ||
360 | 83 | Depends: ${shlibs:Depends}, ${misc:Depends}, | ||
361 | 84 | signon-plugin-oauth2, | ||
362 | 85 | Description: Online account plugin support lib for Unity 7 - Flickr | ||
363 | 86 | Support library for the Unity 7 online account plugin | ||
364 | 67 | 87 | ||
365 | 68 | Package: account-plugin-flickr | 88 | Package: account-plugin-flickr |
366 | 69 | Architecture: all | 89 | Architecture: all |
367 | 70 | Depends: ${misc:Depends}, | 90 | Depends: ${misc:Depends}, |
369 | 71 | libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts, | 91 | libaccount-plugin-flickr | ubuntu-system-settings-online-accounts, |
370 | 72 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 92 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
373 | 73 | Description: GNOME Control Center account plugin for single signon - flickr | 93 | Description: Online account plugin for Unity - Flickr |
374 | 74 | GNOME Control Center account plugins for single signon | 94 | This plugin adds support for creating Flickr accounts in the Unity Control |
375 | 95 | Center | ||
376 | 75 | 96 | ||
377 | 76 | Package: account-plugin-identica | 97 | Package: account-plugin-identica |
378 | 77 | Architecture: all | 98 | Architecture: all |
379 | 78 | Depends: ${misc:Depends}, | 99 | Depends: ${misc:Depends}, |
380 | 79 | libaccount-plugin-generic-oauth, | 100 | libaccount-plugin-generic-oauth, |
381 | 80 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 101 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
384 | 81 | Description: GNOME Control Center account plugin for single signon - identica | 102 | Description: Online account plugin for Unity - identi.ca |
385 | 82 | GNOME Control Center account plugins for single signon | 103 | This plugin adds support for creating identi.ca accounts in the Unity Control |
386 | 104 | Center | ||
387 | 83 | 105 | ||
388 | 84 | Package: account-plugin-foursquare | 106 | Package: account-plugin-foursquare |
389 | 85 | Architecture: all | 107 | Architecture: all |
390 | 86 | Depends: ${misc:Depends}, | 108 | Depends: ${misc:Depends}, |
391 | 87 | libaccount-plugin-generic-oauth, | 109 | libaccount-plugin-generic-oauth, |
392 | 88 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 110 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
395 | 89 | Description: GNOME Control Center account plugin for single signon - foursquare | 111 | Description: Online account plugin for Unity - FourSquare |
396 | 90 | GNOME Control Center account plugins for single signon | 112 | This plugin adds support for creating FourSquare accounts in the Unity |
397 | 113 | Control Center | ||
398 | 91 | 114 | ||
399 | 92 | Package: account-plugin-sohu | 115 | Package: account-plugin-sohu |
400 | 93 | Architecture: all | 116 | Architecture: all |
401 | 94 | Depends: ${misc:Depends}, | 117 | Depends: ${misc:Depends}, |
402 | 95 | libaccount-plugin-generic-oauth, | 118 | libaccount-plugin-generic-oauth, |
403 | 96 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 119 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
406 | 97 | Description: GNOME Control Center account plugin for single signon - sohu | 120 | Description: Online account plugin for Unity - Sohu |
407 | 98 | GNOME Control Center account plugins for single signon | 121 | This plugin adds support for creating Sohu accounts in the Unity Control |
408 | 122 | Center | ||
409 | 99 | 123 | ||
410 | 100 | Package: account-plugin-sina | 124 | Package: account-plugin-sina |
411 | 101 | Architecture: all | 125 | Architecture: all |
412 | 102 | Depends: ${misc:Depends}, | 126 | Depends: ${misc:Depends}, |
413 | 103 | libaccount-plugin-generic-oauth, | 127 | libaccount-plugin-generic-oauth, |
414 | 104 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 128 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
417 | 105 | Description: GNOME Control Center account plugin for single signon - sina | 129 | Description: Online account plugin for Unity - Sina |
418 | 106 | GNOME Control Center account plugins for single signon | 130 | This plugin adds support for creating Sina accounts in the Unity Control |
419 | 131 | Center | ||
420 | 107 | 132 | ||
421 | 108 | Package: account-plugin-linkedin | 133 | Package: account-plugin-linkedin |
422 | 109 | Architecture: all | 134 | Architecture: all |
423 | 110 | Depends: ${misc:Depends}, | 135 | Depends: ${misc:Depends}, |
424 | 111 | libaccount-plugin-generic-oauth, | 136 | libaccount-plugin-generic-oauth, |
425 | 112 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 137 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
428 | 113 | Description: GNOME Control Center account plugin for single signon - LinkedIn | 138 | Description: Online account plugin for Unity - LinkedIn |
429 | 114 | GNOME Control Center account plugins for single signon | 139 | This plugin adds support for creating LinkedIn accounts in the Unity Control |
430 | 140 | Center | ||
431 | 115 | 141 | ||
432 | 116 | Package: account-plugin-instagram | 142 | Package: account-plugin-instagram |
433 | 117 | Architecture: all | 143 | Architecture: all |
434 | 118 | Depends: ${misc:Depends}, | 144 | Depends: ${misc:Depends}, |
435 | 119 | libaccount-plugin-generic-oauth, | 145 | libaccount-plugin-generic-oauth, |
436 | 120 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 146 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
439 | 121 | Description: GNOME Control Center account plugin for single signon - Instagram | 147 | Description: Online account plugin for Unity - Instagram |
440 | 122 | GNOME Control Center account plugins for single signon | 148 | This plugin adds support for creating Instagram accounts in the Unity Control |
441 | 149 | Center | ||
442 | 123 | 150 | ||
443 | 124 | Package: account-plugin-mcloud | 151 | Package: account-plugin-mcloud |
444 | 125 | Architecture: all | 152 | Architecture: all |
445 | 126 | Depends: ${misc:Depends}, | 153 | Depends: ${misc:Depends}, |
446 | 127 | ubuntu-system-settings-online-accounts, | 154 | ubuntu-system-settings-online-accounts, |
450 | 128 | Description: Account plugin for online accounts - mCloud | 155 | Description: Online account plugin for Unity - mCloud |
451 | 129 | Online Accounts plugin provide the user interface to create accounts for | 156 | This plugin adds support for creating mCloud accounts in the Unity Control |
452 | 130 | third party services. | 157 | Center |
453 | 131 | 158 | ||
454 | 132 | Package: account-plugin-owncloud | 159 | Package: account-plugin-owncloud |
455 | 133 | Architecture: all | 160 | Architecture: all |
456 | 134 | Depends: ${misc:Depends}, | 161 | Depends: ${misc:Depends}, |
457 | 135 | ubuntu-system-settings-online-accounts, | 162 | ubuntu-system-settings-online-accounts, |
461 | 136 | Description: Account plugin for online accounts - ownCloud | 163 | Description: Online account plugin for Unity - ownCloud |
462 | 137 | Online Accounts plugin provide the user interface to create accounts for | 164 | This plugin adds support for creating ownCloud accounts in the Unity Control |
463 | 138 | third party services. | 165 | Center |
464 | 139 | 166 | ||
465 | 140 | Package: account-plugin-vk | 167 | Package: account-plugin-vk |
466 | 141 | Architecture: all | 168 | Architecture: all |
467 | 142 | Depends: ${misc:Depends}, | 169 | Depends: ${misc:Depends}, |
468 | 143 | libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts, | 170 | libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts, |
471 | 144 | Description: GNOME Control Center account plugin for single signon - VKontakte | 171 | Description: Online account plugin for Unity - VKontakte |
472 | 145 | GNOME Control Center account plugins for single signon | 172 | This plugin adds support for creating VKontakte accounts in the Unity Control |
473 | 173 | Center | ||
474 | 146 | 174 | ||
475 | 147 | Package: account-plugin-tools | 175 | Package: account-plugin-tools |
476 | 148 | Architecture: all | 176 | Architecture: all |
477 | @@ -154,12 +182,5 @@ | |||
478 | 154 | gir1.2-accounts-1.0, | 182 | gir1.2-accounts-1.0, |
479 | 155 | signon-plugin-oauth2, | 183 | signon-plugin-oauth2, |
480 | 156 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), | 184 | unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1), |
490 | 157 | Description: GNOME Control Center account plugins for single signon - tools | 185 | Description: Online account plugins for Unity - tools |
491 | 158 | GNOME Control Center account plugins for single signon | 186 | Command line tools for managing Online Accounts. |
483 | 159 | |||
484 | 160 | Package: account-plugin-icons | ||
485 | 161 | Depends: unity-asset-pool, ${misc:Depends} | ||
486 | 162 | Architecture: all | ||
487 | 163 | Section: oldlibs | ||
488 | 164 | Description: transitional dummy package | ||
489 | 165 | This is a transitional dummy package. It can safely be removed. | ||
492 | 166 | 187 | ||
493 | === added file 'debian/libaccount-plugin-facebook.install' | |||
494 | --- debian/libaccount-plugin-facebook.install 1970-01-01 00:00:00 +0000 | |||
495 | +++ debian/libaccount-plugin-facebook.install 2016-06-16 11:50:25 +0000 | |||
496 | @@ -0,0 +1,1 @@ | |||
497 | 1 | usr/lib/libaccount-plugin-1.0/providers/libfacebook.so | ||
498 | 0 | 2 | ||
499 | === added file 'debian/libaccount-plugin-flickr.install' | |||
500 | --- debian/libaccount-plugin-flickr.install 1970-01-01 00:00:00 +0000 | |||
501 | +++ debian/libaccount-plugin-flickr.install 2016-06-16 11:50:25 +0000 | |||
502 | @@ -0,0 +1,1 @@ | |||
503 | 1 | usr/lib/libaccount-plugin-1.0/providers/libflickr.so | ||
504 | 0 | 2 | ||
505 | === added file 'debian/libaccount-plugin-twitter.install' | |||
506 | --- debian/libaccount-plugin-twitter.install 1970-01-01 00:00:00 +0000 | |||
507 | +++ debian/libaccount-plugin-twitter.install 2016-06-16 11:50:25 +0000 | |||
508 | @@ -0,0 +1,1 @@ | |||
509 | 1 | usr/lib/libaccount-plugin-1.0/providers/libtwitter.so | ||
510 | 0 | 2 | ||
511 | === modified file 'qml/Makefile.am' | |||
512 | --- qml/Makefile.am 2016-04-18 12:06:17 +0000 | |||
513 | +++ qml/Makefile.am 2016-06-16 11:50:25 +0000 | |||
514 | @@ -2,6 +2,7 @@ | |||
515 | 2 | facebook/Main.qml \ | 2 | facebook/Main.qml \ |
516 | 3 | flickr/Main.qml \ | 3 | flickr/Main.qml \ |
517 | 4 | google/Main.qml \ | 4 | google/Main.qml \ |
518 | 5 | mcloud/Main.qml \ | ||
519 | 5 | owncloud/Main.qml \ | 6 | owncloud/Main.qml \ |
520 | 6 | owncloud/NewAccount.qml \ | 7 | owncloud/NewAccount.qml \ |
521 | 7 | twitter/Main.qml \ | 8 | twitter/Main.qml \ |
522 | 8 | 9 | ||
523 | === removed file 'qml/mcloud/ErrorItem.qml' | |||
524 | --- qml/mcloud/ErrorItem.qml 2016-05-31 08:53:33 +0000 | |||
525 | +++ qml/mcloud/ErrorItem.qml 1970-01-01 00:00:00 +0000 | |||
526 | @@ -1,48 +0,0 @@ | |||
527 | 1 | /* | ||
528 | 2 | * Copyright (C) 2015 Canonical Ltd. | ||
529 | 3 | * | ||
530 | 4 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> | ||
531 | 5 | * | ||
532 | 6 | * This program is free software: you can redistribute it and/or modify it | ||
533 | 7 | * under the terms of the GNU General Public License version 3, as published | ||
534 | 8 | * by the Free Software Foundation. | ||
535 | 9 | * | ||
536 | 10 | * This program is distributed in the hope that it will be useful, but | ||
537 | 11 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
538 | 12 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
539 | 13 | * PURPOSE. See the GNU General Public License for more details. | ||
540 | 14 | * | ||
541 | 15 | * You should have received a copy of the GNU General Public License along | ||
542 | 16 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
543 | 17 | */ | ||
544 | 18 | |||
545 | 19 | import QtQuick 2.0 | ||
546 | 20 | import Ubuntu.Components 0.1 | ||
547 | 21 | import Ubuntu.Components.ListItems 0.1 as ListItem | ||
548 | 22 | |||
549 | 23 | Item { | ||
550 | 24 | id: root | ||
551 | 25 | |||
552 | 26 | signal retryRequested() | ||
553 | 27 | |||
554 | 28 | Column { | ||
555 | 29 | anchors { | ||
556 | 30 | verticalCenter: parent.verticalCenter | ||
557 | 31 | left: parent.left; right: parent.right | ||
558 | 32 | } | ||
559 | 33 | spacing: units.gu(2) | ||
560 | 34 | |||
561 | 35 | Label { | ||
562 | 36 | anchors { left: parent.left; right: parent.right } | ||
563 | 37 | text: i18n.dtr("ubuntu-system-settings-online-accounts", "This service is not available right now. Try again later.") | ||
564 | 38 | wrapMode: Text.WordWrap | ||
565 | 39 | horizontalAlignment: Text.AlignHCenter | ||
566 | 40 | } | ||
567 | 41 | |||
568 | 42 | Button { | ||
569 | 43 | anchors.horizontalCenter: parent.horizontalCenter | ||
570 | 44 | text: i18n.dtr("ubuntu-system-settings-online-accounts", "Try Again") | ||
571 | 45 | onClicked: root.retryRequested() | ||
572 | 46 | } | ||
573 | 47 | } | ||
574 | 48 | } | ||
575 | 49 | 0 | ||
576 | === modified file 'qml/mcloud/Main.qml' | |||
577 | --- qml/mcloud/Main.qml 2016-05-31 08:53:33 +0000 | |||
578 | +++ qml/mcloud/Main.qml 2016-06-16 11:50:25 +0000 | |||
579 | @@ -1,7 +1,6 @@ | |||
580 | 1 | import Ubuntu.OnlineAccounts.Plugin 1.0 | 1 | import Ubuntu.OnlineAccounts.Plugin 1.0 |
581 | 2 | import "." as Local | ||
582 | 3 | 2 | ||
583 | 4 | OAuthMain { | 3 | OAuthMain { |
586 | 5 | creationComponent: Local.OAuth { | 4 | creationComponent: OAuth { |
587 | 6 | } | 5 | } |
588 | 7 | } | 6 | } |
589 | 8 | 7 | ||
590 | === removed file 'qml/mcloud/OAuth.qml' | |||
591 | --- qml/mcloud/OAuth.qml 2016-05-31 08:53:33 +0000 | |||
592 | +++ qml/mcloud/OAuth.qml 1970-01-01 00:00:00 +0000 | |||
593 | @@ -1,283 +0,0 @@ | |||
594 | 1 | /* | ||
595 | 2 | * Copyright (C) 2013-2016 Canonical Ltd. | ||
596 | 3 | * | ||
597 | 4 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> | ||
598 | 5 | * | ||
599 | 6 | * This program is free software: you can redistribute it and/or modify it | ||
600 | 7 | * under the terms of the GNU General Public License version 3, as published | ||
601 | 8 | * by the Free Software Foundation. | ||
602 | 9 | * | ||
603 | 10 | * This program is distributed in the hope that it will be useful, but | ||
604 | 11 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
605 | 12 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
606 | 13 | * PURPOSE. See the GNU General Public License for more details. | ||
607 | 14 | * | ||
608 | 15 | * You should have received a copy of the GNU General Public License along | ||
609 | 16 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
610 | 17 | */ | ||
611 | 18 | |||
612 | 19 | import QtQuick 2.0 | ||
613 | 20 | import Ubuntu.Components 1.3 | ||
614 | 21 | import Ubuntu.Components.ListItems 1.3 as ListItem | ||
615 | 22 | import Ubuntu.Components.Popups 1.3 | ||
616 | 23 | import Ubuntu.OnlineAccounts 0.1 | ||
617 | 24 | import Ubuntu.OnlineAccounts.Plugin 1.0 | ||
618 | 25 | |||
619 | 26 | Item { | ||
620 | 27 | id: root | ||
621 | 28 | |||
622 | 29 | /* To override the parameters coming from the .provider file: */ | ||
623 | 30 | property variant authenticationParameters: {} | ||
624 | 31 | /* To override the default access control list: */ | ||
625 | 32 | property variant accessControlList: ["unconfined"] | ||
626 | 33 | |||
627 | 34 | property variant authReply | ||
628 | 35 | property bool isNewAccount: false | ||
629 | 36 | property variant __account: account | ||
630 | 37 | property bool __isAuthenticating: false | ||
631 | 38 | property alias globalAccountService: globalAccountSettings | ||
632 | 39 | property bool loading: loader.status == Loader.Null || loader.status == Loader.Loading | ||
633 | 40 | |||
634 | 41 | signal authenticated(variant reply) | ||
635 | 42 | signal authenticationError(variant error) | ||
636 | 43 | signal finished | ||
637 | 44 | |||
638 | 45 | anchors.fill: parent | ||
639 | 46 | |||
640 | 47 | Component.onCompleted: { | ||
641 | 48 | isNewAccount = (account.accountId === 0) | ||
642 | 49 | enableAccount() | ||
643 | 50 | authenticate() | ||
644 | 51 | } | ||
645 | 52 | |||
646 | 53 | RequestHandler { | ||
647 | 54 | id: requestHandler | ||
648 | 55 | onRequestChanged: { | ||
649 | 56 | if (request) { | ||
650 | 57 | console.log("RequestHandler captured request!") | ||
651 | 58 | loader.setSource("WebView.qml", { | ||
652 | 59 | "signonRequest": request | ||
653 | 60 | }) | ||
654 | 61 | } else { | ||
655 | 62 | console.log("Request destroyed!") | ||
656 | 63 | loader.source = "" | ||
657 | 64 | } | ||
658 | 65 | } | ||
659 | 66 | } | ||
660 | 67 | |||
661 | 68 | Credentials { | ||
662 | 69 | id: creds | ||
663 | 70 | caption: account.provider.id | ||
664 | 71 | acl: accessControlList | ||
665 | 72 | onCredentialsIdChanged: root.credentialsStored() | ||
666 | 73 | } | ||
667 | 74 | |||
668 | 75 | AccountService { | ||
669 | 76 | id: globalAccountSettings | ||
670 | 77 | objectHandle: account.accountServiceHandle | ||
671 | 78 | credentials: creds | ||
672 | 79 | autoSync: false | ||
673 | 80 | |||
674 | 81 | onAuthenticated: { | ||
675 | 82 | __isAuthenticating = false | ||
676 | 83 | authReply = reply | ||
677 | 84 | root.authenticated(reply) | ||
678 | 85 | } | ||
679 | 86 | onAuthenticationError: { | ||
680 | 87 | __isAuthenticating = false | ||
681 | 88 | root.authenticationError(error) | ||
682 | 89 | } | ||
683 | 90 | } | ||
684 | 91 | |||
685 | 92 | AccountServiceModel { | ||
686 | 93 | id: accountServices | ||
687 | 94 | includeDisabled: true | ||
688 | 95 | account: __account.objectHandle | ||
689 | 96 | } | ||
690 | 97 | |||
691 | 98 | ListItem.Base { | ||
692 | 99 | visible: loading && !errorItem.visible | ||
693 | 100 | height: units.gu(7) | ||
694 | 101 | showDivider: false | ||
695 | 102 | anchors.top: parent.top | ||
696 | 103 | |||
697 | 104 | Item { | ||
698 | 105 | height: units.gu(5) | ||
699 | 106 | width: units.gu(30) | ||
700 | 107 | anchors.horizontalCenter: parent.horizontalCenter | ||
701 | 108 | anchors.top: parent.top | ||
702 | 109 | anchors.margins: units.gu(1) | ||
703 | 110 | |||
704 | 111 | ActivityIndicator { | ||
705 | 112 | id: loadingIndicator | ||
706 | 113 | anchors.verticalCenter: parent.verticalCenter | ||
707 | 114 | anchors.left: parent.left | ||
708 | 115 | anchors.leftMargin: units.gu(5) | ||
709 | 116 | running: loading | ||
710 | 117 | z: 1 | ||
711 | 118 | } | ||
712 | 119 | Label { | ||
713 | 120 | text: i18n.dtr("ubuntu-system-settings-online-accounts", "Loading…") | ||
714 | 121 | anchors.verticalCenter: parent.verticalCenter | ||
715 | 122 | anchors.left: loadingIndicator.right | ||
716 | 123 | anchors.leftMargin: units.gu(3) | ||
717 | 124 | } | ||
718 | 125 | } | ||
719 | 126 | } | ||
720 | 127 | |||
721 | 128 | Loader { | ||
722 | 129 | id: loader | ||
723 | 130 | anchors { | ||
724 | 131 | top: parent.top | ||
725 | 132 | left: parent.left | ||
726 | 133 | right: parent.right | ||
727 | 134 | bottom: Qt.inputMethod.visible ? osk.top : cancelButton.top | ||
728 | 135 | } | ||
729 | 136 | focus: true | ||
730 | 137 | visible: !loading | ||
731 | 138 | } | ||
732 | 139 | |||
733 | 140 | ErrorItem { | ||
734 | 141 | id: errorItem | ||
735 | 142 | anchors { fill: parent; margins: units.gu(4) } | ||
736 | 143 | visible: false | ||
737 | 144 | onRetryRequested: { | ||
738 | 145 | root.credentialsStored() | ||
739 | 146 | visible = false | ||
740 | 147 | } | ||
741 | 148 | } | ||
742 | 149 | |||
743 | 150 | KeyboardRectangle { | ||
744 | 151 | id: osk | ||
745 | 152 | } | ||
746 | 153 | |||
747 | 154 | ListItem.SingleControl { | ||
748 | 155 | id: cancelButton | ||
749 | 156 | anchors.bottom: parent.bottom | ||
750 | 157 | showDivider: false | ||
751 | 158 | control: Button { | ||
752 | 159 | text: i18n.dtr("ubuntu-system-settings-online-accounts", "Cancel") | ||
753 | 160 | width: parent.width - units.gu(4) | ||
754 | 161 | onClicked: root.cancel() | ||
755 | 162 | } | ||
756 | 163 | } | ||
757 | 164 | |||
758 | 165 | AccountServiceModel { | ||
759 | 166 | id: possiblyDuplicateAccounts | ||
760 | 167 | service: "global" | ||
761 | 168 | provider: __account.provider.id | ||
762 | 169 | } | ||
763 | 170 | |||
764 | 171 | function authenticate() { | ||
765 | 172 | console.log("Authenticating...") | ||
766 | 173 | creds.sync() | ||
767 | 174 | } | ||
768 | 175 | |||
769 | 176 | function credentialsStored() { | ||
770 | 177 | console.log("Credentials stored, id: " + creds.credentialsId) | ||
771 | 178 | if (creds.credentialsId == 0) return | ||
772 | 179 | var parameters = {} | ||
773 | 180 | parameters[requestHandler.matchKey] = requestHandler.matchId | ||
774 | 181 | parameters["providerId"] = account.provider.id | ||
775 | 182 | for (var p in authenticationParameters) { | ||
776 | 183 | parameters[p] = authenticationParameters[p] | ||
777 | 184 | } | ||
778 | 185 | __isAuthenticating = true | ||
779 | 186 | globalAccountSettings.authenticate(parameters) | ||
780 | 187 | } | ||
781 | 188 | |||
782 | 189 | function cancel() { | ||
783 | 190 | if (__isAuthenticating) { | ||
784 | 191 | /* This will cause the authentication to fail, and this method will | ||
785 | 192 | * be invoked again to delete the credentials. */ | ||
786 | 193 | globalAccountSettings.cancelAuthentication() | ||
787 | 194 | return | ||
788 | 195 | } | ||
789 | 196 | if (isNewAccount && creds.credentialsId != 0) { | ||
790 | 197 | console.log("Removing credentials...") | ||
791 | 198 | creds.remove() | ||
792 | 199 | creds.removed.connect(finished) | ||
793 | 200 | } else { | ||
794 | 201 | finished() | ||
795 | 202 | } | ||
796 | 203 | } | ||
797 | 204 | |||
798 | 205 | function enableAccount() { | ||
799 | 206 | globalAccountSettings.updateServiceEnabled(true) | ||
800 | 207 | } | ||
801 | 208 | |||
802 | 209 | function getUserName(reply, callback) { | ||
803 | 210 | /* This should work for OAuth 1.0a; for OAuth 2.0 this function needs | ||
804 | 211 | * to be reimplemented */ | ||
805 | 212 | if ('ScreenName' in reply) return reply.ScreenName | ||
806 | 213 | else if ('UserId' in reply) return reply.UserId | ||
807 | 214 | return '' | ||
808 | 215 | } | ||
809 | 216 | |||
810 | 217 | function accountIsDuplicate(userName) { | ||
811 | 218 | var model = possiblyDuplicateAccounts | ||
812 | 219 | for (var i = 0; i < model.count; i++) { | ||
813 | 220 | if (model.get(i, "displayName") == userName) | ||
814 | 221 | return true | ||
815 | 222 | } | ||
816 | 223 | return false | ||
817 | 224 | } | ||
818 | 225 | |||
819 | 226 | function __gotUserName(userName, reply) { | ||
820 | 227 | console.log("UserName: " + userName) | ||
821 | 228 | if (userName != '') { | ||
822 | 229 | if (accountIsDuplicate(userName)) { | ||
823 | 230 | var dialog = PopupUtils.open(Qt.resolvedUrl("DuplicateAccount.qml")) | ||
824 | 231 | dialog.closed.connect(cancel) | ||
825 | 232 | return | ||
826 | 233 | } | ||
827 | 234 | account.updateDisplayName(userName) | ||
828 | 235 | } | ||
829 | 236 | beforeSaving(reply) | ||
830 | 237 | } | ||
831 | 238 | |||
832 | 239 | function saveAccount() { | ||
833 | 240 | account.synced.connect(finished) | ||
834 | 241 | account.sync() | ||
835 | 242 | } | ||
836 | 243 | |||
837 | 244 | /* reimplement this function in plugins in order to perform some actions | ||
838 | 245 | * before quitting the plugin */ | ||
839 | 246 | function beforeSaving(reply) { | ||
840 | 247 | saveAccount() | ||
841 | 248 | } | ||
842 | 249 | |||
843 | 250 | function __getUserNameAndSave(reply) { | ||
844 | 251 | /* If the completeCreation function is defined, run it */ | ||
845 | 252 | if (typeof(completeCreation) == "function") { | ||
846 | 253 | console.warn("The completeCreation method is deprecated; use getUserName() or beforeSaving() instead") | ||
847 | 254 | completeCreation(reply) | ||
848 | 255 | return | ||
849 | 256 | } | ||
850 | 257 | |||
851 | 258 | var userName = getUserName(reply, function(name) { | ||
852 | 259 | __gotUserName(name, reply) | ||
853 | 260 | }) | ||
854 | 261 | if (typeof(userName) == "string") { | ||
855 | 262 | __gotUserName(userName, reply) | ||
856 | 263 | } else if (userName === false) { | ||
857 | 264 | cancel() | ||
858 | 265 | return | ||
859 | 266 | } | ||
860 | 267 | // otherwise (userName === true), wait for the callback to be invoked | ||
861 | 268 | } | ||
862 | 269 | |||
863 | 270 | onAuthenticated: __getUserNameAndSave(reply) | ||
864 | 271 | |||
865 | 272 | onAuthenticationError: { | ||
866 | 273 | console.log("Authentication error, code " + error.code) | ||
867 | 274 | if (error.code == AccountService.NetworkError) { | ||
868 | 275 | console.log("Network error") | ||
869 | 276 | errorItem.visible = true | ||
870 | 277 | return | ||
871 | 278 | } | ||
872 | 279 | root.cancel() | ||
873 | 280 | } | ||
874 | 281 | |||
875 | 282 | onFinished: loading = false | ||
876 | 283 | } | ||
877 | 284 | 0 | ||
878 | === removed file 'qml/mcloud/WebView.qml' | |||
879 | --- qml/mcloud/WebView.qml 2016-05-31 08:53:33 +0000 | |||
880 | +++ qml/mcloud/WebView.qml 1970-01-01 00:00:00 +0000 | |||
881 | @@ -1,94 +0,0 @@ | |||
882 | 1 | import QtQuick 2.0 | ||
883 | 2 | import Ubuntu.Components 1.1 | ||
884 | 3 | import Ubuntu.Web 0.2 | ||
885 | 4 | |||
886 | 5 | WebView { | ||
887 | 6 | id: root | ||
888 | 7 | |||
889 | 8 | property QtObject signonRequest | ||
890 | 9 | readonly property string token_url: "https://ose.caiyun.feixin.10086.cn/oauthApp/OAuth2/getToken" | ||
891 | 10 | readonly property string redirect_url: "http://developer.ubuntu.com/en/" | ||
892 | 11 | readonly property string client_id: "APP1ZtqoN3R0002" | ||
893 | 12 | readonly property string client_pass: "A70EFCDC91456349E7FDECF0A33574AC" | ||
894 | 13 | |||
895 | 14 | Component.onCompleted: { | ||
896 | 15 | signonRequest.authenticated.connect(onAuthenticated) | ||
897 | 16 | url = signonRequest.startUrl | ||
898 | 17 | } | ||
899 | 18 | |||
900 | 19 | //1.WORKAROUND: we need to retrieve refresh token instead of access token. | ||
901 | 20 | function fetchRefreshToken(code) { | ||
902 | 21 | var http = new XMLHttpRequest() | ||
903 | 22 | var body = "grant_type=authorization_code&code="+code+"&redirect_uri="+redirect_url | ||
904 | 23 | |||
905 | 24 | http.open("POST", token_url, true); | ||
906 | 25 | http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | ||
907 | 26 | http.setRequestHeader("Authorization", "Basic " + Qt.btoa(client_id + ":" + client_pass)); | ||
908 | 27 | http.onreadystatechange = function() { | ||
909 | 28 | if (http.readyState === 4 && http.status == 200) { | ||
910 | 29 | var response = JSON.parse(http.responseText) | ||
911 | 30 | //create a fake access_token with refresh token. | ||
912 | 31 | var urlStr = redirect_url+"#access_token="+response.refresh_token | ||
913 | 32 | var authUrl = Qt.resolvedUrl(urlStr); | ||
914 | 33 | signonRequest.currentUrl = authUrl | ||
915 | 34 | } else { | ||
916 | 35 | console.log("error: " + http.status) | ||
917 | 36 | } | ||
918 | 37 | }; | ||
919 | 38 | |||
920 | 39 | http.send(body); | ||
921 | 40 | } | ||
922 | 41 | |||
923 | 42 | onLoadingStateChanged: { | ||
924 | 43 | if (loading) { | ||
925 | 44 | signonRequest.onLoadStarted() | ||
926 | 45 | } else if (lastLoadSucceeded) { | ||
927 | 46 | signonRequest.onLoadFinished(true) | ||
928 | 47 | } else { | ||
929 | 48 | signonRequest.onLoadFinished(false) | ||
930 | 49 | } | ||
931 | 50 | } | ||
932 | 51 | |||
933 | 52 | onUrlChanged: { | ||
934 | 53 | //2.WORKAROUND: retrieve refresh token if code is fetched | ||
935 | 54 | var code_pattern= new RegExp("\\?code=.*&"); | ||
936 | 55 | var urlStr = url.toString() | ||
937 | 56 | if (code_pattern.test(urlStr)){ | ||
938 | 57 | var code = urlStr.match(/\?code=(.*)&/)[1]; | ||
939 | 58 | console.log("code::", code) | ||
940 | 59 | fetchRefreshToken(code) | ||
941 | 60 | } else { | ||
942 | 61 | signonRequest.currentUrl = url | ||
943 | 62 | } | ||
944 | 63 | } | ||
945 | 64 | |||
946 | 65 | //3.WORKAROUND: Apply desktop useragent to prevent server from detecting android client, | ||
947 | 66 | //which causes authentication failure. | ||
948 | 67 | context: WebContext { | ||
949 | 68 | dataPath: signonRequest ? signonRequest.rootDir : "" | ||
950 | 69 | userAgent: "Mozilla/5.0 (Linux; Ubuntu 14.04) AppleWebKit/537.36 Chromium/35.0.1870.2 Safari/537.36" | ||
951 | 70 | } | ||
952 | 71 | |||
953 | 72 | function onAuthenticated() { | ||
954 | 73 | /* Get the cookies and set them on the request */ | ||
955 | 74 | console.log("Authenticated; getting cookies") | ||
956 | 75 | context.cookieManager.getCookiesResponse.connect(onGotCookies) | ||
957 | 76 | context.cookieManager.getAllCookies() | ||
958 | 77 | visible = false | ||
959 | 78 | } | ||
960 | 79 | |||
961 | 80 | function onGotCookies(requestId, cookies) { | ||
962 | 81 | signonRequest.setCookies(cookies) | ||
963 | 82 | } | ||
964 | 83 | |||
965 | 84 | /* Taken from webbrowser-app */ | ||
966 | 85 | ProgressBar { | ||
967 | 86 | anchors.top: parent.top | ||
968 | 87 | anchors.left: parent.left | ||
969 | 88 | anchors.right: parent.right | ||
970 | 89 | height: units.dp(3) | ||
971 | 90 | showProgressPercentage: false | ||
972 | 91 | visible: root.loading | ||
973 | 92 | value: root.loadProgress / 100 | ||
974 | 93 | } | ||
975 | 94 | } | ||
976 | 95 | 0 | ||
977 | === added file 'src/facebook.vala' | |||
978 | --- src/facebook.vala 1970-01-01 00:00:00 +0000 | |||
979 | +++ src/facebook.vala 2016-06-16 11:50:25 +0000 | |||
980 | @@ -0,0 +1,69 @@ | |||
981 | 1 | /* | ||
982 | 2 | * Copyright (C) 2016 Canonical, Inc | ||
983 | 3 | * | ||
984 | 4 | * This program is free software; you can redistribute it and/or modify | ||
985 | 5 | * it under the terms of the GNU General Public License version 2 as | ||
986 | 6 | * published by the Free Software Foundation. | ||
987 | 7 | * | ||
988 | 8 | * This program is distributed in the hope that it will be useful, | ||
989 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
990 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
991 | 11 | * GNU General Public License for more details. | ||
992 | 12 | * | ||
993 | 13 | * You should have received a copy of the GNU General Public License | ||
994 | 14 | * along with this program; if not, write to the Free Software | ||
995 | 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
996 | 16 | * USA. | ||
997 | 17 | * | ||
998 | 18 | * Authors: | ||
999 | 19 | * Alberto Mardegan <alberto.mardegan@canonical.com> | ||
1000 | 20 | */ | ||
1001 | 21 | |||
1002 | 22 | public class FacebookPlugin : Ap.OAuthPlugin { | ||
1003 | 23 | private Soup.Session session; | ||
1004 | 24 | |||
1005 | 25 | public FacebookPlugin (Ag.Account account) { | ||
1006 | 26 | Object (account: account); | ||
1007 | 27 | } | ||
1008 | 28 | |||
1009 | 29 | private void fetch_username (string access_token) { | ||
1010 | 30 | debug ("fetching username, AT = " + access_token); | ||
1011 | 31 | Soup.URI destination_uri = | ||
1012 | 32 | new Soup.URI ("https://graph.facebook.com/me?access_token=" + | ||
1013 | 33 | access_token); | ||
1014 | 34 | var message = new Soup.Message.from_uri ("GET", destination_uri); | ||
1015 | 35 | session = new Soup.Session (); | ||
1016 | 36 | session.queue_message (message, (sess, msg) => { | ||
1017 | 37 | debug ("Got message reply"); | ||
1018 | 38 | string body = (string) msg.response_body.data; | ||
1019 | 39 | Json.Parser parser = new Json.Parser (); | ||
1020 | 40 | try { | ||
1021 | 41 | parser.load_from_data (body); | ||
1022 | 42 | |||
1023 | 43 | Json.Node root = parser.get_root (); | ||
1024 | 44 | Json.Object response_object = root.get_object (); | ||
1025 | 45 | var username = response_object.get_string_member ("name"); | ||
1026 | 46 | account.set_display_name (username); | ||
1027 | 47 | } catch (Error error) { | ||
1028 | 48 | warning ("Could not parse reply: " + body); | ||
1029 | 49 | } | ||
1030 | 50 | |||
1031 | 51 | store_account (); | ||
1032 | 52 | }); | ||
1033 | 53 | } | ||
1034 | 54 | |||
1035 | 55 | protected override void query_username () { | ||
1036 | 56 | var reply = get_oauth_reply (); | ||
1037 | 57 | Variant? v_token = reply.lookup_value ("AccessToken", null); | ||
1038 | 58 | if (v_token != null) { | ||
1039 | 59 | fetch_username (v_token.get_string ()); | ||
1040 | 60 | } else { | ||
1041 | 61 | store_account (); | ||
1042 | 62 | } | ||
1043 | 63 | } | ||
1044 | 64 | } | ||
1045 | 65 | |||
1046 | 66 | public GLib.Type ap_module_get_object_type () | ||
1047 | 67 | { | ||
1048 | 68 | return typeof (FacebookPlugin); | ||
1049 | 69 | } | ||
1050 | 0 | 70 | ||
1051 | === added file 'src/flickr.vala' | |||
1052 | --- src/flickr.vala 1970-01-01 00:00:00 +0000 | |||
1053 | +++ src/flickr.vala 2016-06-16 11:50:25 +0000 | |||
1054 | @@ -0,0 +1,41 @@ | |||
1055 | 1 | /* | ||
1056 | 2 | * Copyright (C) 2016 Canonical, Inc | ||
1057 | 3 | * | ||
1058 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1059 | 5 | * it under the terms of the GNU General Public License version 2 as | ||
1060 | 6 | * published by the Free Software Foundation. | ||
1061 | 7 | * | ||
1062 | 8 | * This program is distributed in the hope that it will be useful, | ||
1063 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1064 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1065 | 11 | * GNU General Public License for more details. | ||
1066 | 12 | * | ||
1067 | 13 | * You should have received a copy of the GNU General Public License | ||
1068 | 14 | * along with this program; if not, write to the Free Software | ||
1069 | 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
1070 | 16 | * USA. | ||
1071 | 17 | * | ||
1072 | 18 | * Authors: | ||
1073 | 19 | * Alberto Mardegan <alberto.mardegan@canonical.com> | ||
1074 | 20 | */ | ||
1075 | 21 | |||
1076 | 22 | public class FlickrPlugin : Ap.OAuthPlugin { | ||
1077 | 23 | public FlickrPlugin (Ag.Account account) { | ||
1078 | 24 | Object (account: account); | ||
1079 | 25 | } | ||
1080 | 26 | |||
1081 | 27 | protected override void query_username () { | ||
1082 | 28 | var reply = get_oauth_reply (); | ||
1083 | 29 | Variant? v_name = reply.lookup_value ("username", null); | ||
1084 | 30 | if (v_name != null) { | ||
1085 | 31 | account.set_display_name (v_name.get_string ()); | ||
1086 | 32 | } | ||
1087 | 33 | |||
1088 | 34 | store_account (); | ||
1089 | 35 | } | ||
1090 | 36 | } | ||
1091 | 37 | |||
1092 | 38 | public GLib.Type ap_module_get_object_type () | ||
1093 | 39 | { | ||
1094 | 40 | return typeof (FlickrPlugin); | ||
1095 | 41 | } | ||
1096 | 0 | 42 | ||
1097 | === modified file 'src/google.vala' | |||
1098 | --- src/google.vala 2013-06-06 13:16:51 +0000 | |||
1099 | +++ src/google.vala 2016-06-16 11:50:25 +0000 | |||
1100 | @@ -1,5 +1,5 @@ | |||
1101 | 1 | /* | 1 | /* |
1103 | 2 | * Copyright (C) 2012 Canonical, Inc | 2 | * Copyright (C) 2012-2016 Canonical, Inc |
1104 | 3 | * | 3 | * |
1105 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
1106 | 5 | * it under the terms of the GNU General Public License version 2 as | 5 | * it under the terms of the GNU General Public License version 2 as |
1107 | @@ -20,6 +20,8 @@ | |||
1108 | 20 | */ | 20 | */ |
1109 | 21 | 21 | ||
1110 | 22 | public class GooglePlugin : Ap.OAuthPlugin { | 22 | public class GooglePlugin : Ap.OAuthPlugin { |
1111 | 23 | private Soup.Session session; | ||
1112 | 24 | |||
1113 | 23 | public GooglePlugin (Ag.Account account) { | 25 | public GooglePlugin (Ag.Account account) { |
1114 | 24 | Object (account: account); | 26 | Object (account: account); |
1115 | 25 | } | 27 | } |
1116 | @@ -44,6 +46,43 @@ | |||
1117 | 44 | 46 | ||
1118 | 45 | set_ignore_cookies (true); | 47 | set_ignore_cookies (true); |
1119 | 46 | } | 48 | } |
1120 | 49 | |||
1121 | 50 | private void fetch_username (string access_token) { | ||
1122 | 51 | debug ("fetching username, AT = " + access_token); | ||
1123 | 52 | Soup.URI destination_uri = | ||
1124 | 53 | new Soup.URI ("https://www.googleapis.com/oauth2/v3/userinfo"); | ||
1125 | 54 | var message = new Soup.Message.from_uri ("POST", destination_uri); | ||
1126 | 55 | message.request_headers.append ("Authorization", "Bearer " + access_token); | ||
1127 | 56 | message.request_headers.set_content_length (0); | ||
1128 | 57 | session = new Soup.Session (); | ||
1129 | 58 | session.queue_message (message, (sess, msg) => { | ||
1130 | 59 | debug ("Got message reply"); | ||
1131 | 60 | string body = (string) msg.response_body.data; | ||
1132 | 61 | Json.Parser parser = new Json.Parser (); | ||
1133 | 62 | try { | ||
1134 | 63 | parser.load_from_data (body); | ||
1135 | 64 | |||
1136 | 65 | Json.Node root = parser.get_root (); | ||
1137 | 66 | Json.Object response_object = root.get_object (); | ||
1138 | 67 | var username = response_object.get_string_member ("email"); | ||
1139 | 68 | account.set_display_name (username); | ||
1140 | 69 | } catch (Error error) { | ||
1141 | 70 | warning ("Could not parse reply: " + body); | ||
1142 | 71 | } | ||
1143 | 72 | |||
1144 | 73 | store_account (); | ||
1145 | 74 | }); | ||
1146 | 75 | } | ||
1147 | 76 | |||
1148 | 77 | protected override void query_username () { | ||
1149 | 78 | var reply = get_oauth_reply (); | ||
1150 | 79 | Variant? v_token = reply.lookup_value ("AccessToken", null); | ||
1151 | 80 | if (v_token != null) { | ||
1152 | 81 | fetch_username (v_token.get_string ()); | ||
1153 | 82 | } else { | ||
1154 | 83 | store_account (); | ||
1155 | 84 | } | ||
1156 | 85 | } | ||
1157 | 47 | } | 86 | } |
1158 | 48 | 87 | ||
1159 | 49 | public GLib.Type ap_module_get_object_type () | 88 | public GLib.Type ap_module_get_object_type () |
1160 | 50 | 89 | ||
1161 | === added file 'src/twitter.vala' | |||
1162 | --- src/twitter.vala 1970-01-01 00:00:00 +0000 | |||
1163 | +++ src/twitter.vala 2016-06-16 11:50:25 +0000 | |||
1164 | @@ -0,0 +1,46 @@ | |||
1165 | 1 | /* | ||
1166 | 2 | * Copyright (C) 2016 Canonical, Inc | ||
1167 | 3 | * | ||
1168 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1169 | 5 | * it under the terms of the GNU General Public License version 2 as | ||
1170 | 6 | * published by the Free Software Foundation. | ||
1171 | 7 | * | ||
1172 | 8 | * This program is distributed in the hope that it will be useful, | ||
1173 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1174 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1175 | 11 | * GNU General Public License for more details. | ||
1176 | 12 | * | ||
1177 | 13 | * You should have received a copy of the GNU General Public License | ||
1178 | 14 | * along with this program; if not, write to the Free Software | ||
1179 | 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
1180 | 16 | * USA. | ||
1181 | 17 | * | ||
1182 | 18 | * Authors: | ||
1183 | 19 | * Alberto Mardegan <alberto.mardegan@canonical.com> | ||
1184 | 20 | */ | ||
1185 | 21 | |||
1186 | 22 | public class TwitterPlugin : Ap.OAuthPlugin { | ||
1187 | 23 | public TwitterPlugin (Ag.Account account) { | ||
1188 | 24 | Object (account: account); | ||
1189 | 25 | } | ||
1190 | 26 | |||
1191 | 27 | protected override void query_username () { | ||
1192 | 28 | var reply = get_oauth_reply (); | ||
1193 | 29 | Variant? v_name = reply.lookup_value ("ScreenName", null); | ||
1194 | 30 | if (v_name != null) { | ||
1195 | 31 | account.set_display_name (v_name.get_string ()); | ||
1196 | 32 | } else { | ||
1197 | 33 | v_name = reply.lookup_value ("UserId", null); | ||
1198 | 34 | if (v_name != null) { | ||
1199 | 35 | account.set_display_name (v_name.get_string ()); | ||
1200 | 36 | } | ||
1201 | 37 | } | ||
1202 | 38 | |||
1203 | 39 | store_account (); | ||
1204 | 40 | } | ||
1205 | 41 | } | ||
1206 | 42 | |||
1207 | 43 | public GLib.Type ap_module_get_object_type () | ||
1208 | 44 | { | ||
1209 | 45 | return typeof (TwitterPlugin); | ||
1210 | 46 | } |
Thanks for this MP, mandy.
It looks good to me.
I know the reason why you apply this change in the signon-plugin-oauth (https:/ /gitlab. com/accounts- sso/signon- plugin- oauth2/ commit/ e812eb3e76a1221 074e3cf27208aac ced5091e42). /ose.caiyun. feixin. 10086.cn/ oauthApp/ OAuth2/ getToken</setting>
And modify the TokenPath here accordingly. :)
...
<setting name="TokenPath">https:/
...
I'd like to test it on my side with my phone, could you please give me the silo number for accounts- sso/signon- plugin- oauth2 with your patch applied after you finish verification.
Thanks.