Merge lp:~mardy/account-plugins/mcloud-plugin-lp1587282 into lp:~gary-wzl77/account-plugins/mcloud-plugin-lp1587282

Proposed by Alberto Mardegan
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
Reviewer Review Type Date Requested Status
Gary.Wang Approve
Review via email: mp+296288@code.launchpad.net

Description of the change

Use the web based flow for authentication

To post a comment you must log in.
165. By Alberto Mardegan

Enable state parameter

Revision history for this message
Gary.Wang (gary-wzl77) wrote :

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/e812eb3e76a1221074e3cf27208aacced5091e42).
And modify the TokenPath here accordingly. :)
...
<setting name="TokenPath">https://ose.caiyun.feixin.10086.cn/oauthApp/OAuth2/getToken</setting>
...

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.

Revision history for this message
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-sso/signon-plugin-oauth2 with your patch applied
> 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://launchpad.net/~mardy/+archive/ubuntu/phablet/+packages

While I'm writing this the signon-plugin-oauth is still building on armhf, but it should be ready soon.

Revision history for this message
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.

review: Approve
Revision history for this message
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://requests.ci-train.ubuntu.com/#/ticket/1497

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.

Revision history for this message
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2016-05-31 08:53:33 +0000
+++ .bzrignore 2016-06-16 11:50:25 +0000
@@ -6,6 +6,7 @@
6*.service6*.service
7*.substvars7*.substvars
8*.stamp8*.stamp
9*.trs
9INSTALL10INSTALL
10Makefile11Makefile
11Makefile.in12Makefile.in
@@ -53,7 +54,11 @@
53.deps54.deps
54.dirstamp55.dirstamp
55.libs56.libs
57/src/facebook.c
58/src/flickr.c
56/src/generic-oauth.c59/src/generic-oauth.c
57/src/google.c60/src/google.c
61/src/twitter.c
62/test-driver
58/test-provider63/test-provider
59/test-service64/test-service
6065
=== modified file 'Makefile.am'
--- Makefile.am 2016-05-31 08:53:33 +0000
+++ Makefile.am 2016-06-16 11:50:25 +0000
@@ -8,8 +8,11 @@
8if ENABLE_LIBACCOUNT_PLUGIN8if ENABLE_LIBACCOUNT_PLUGIN
9# Binary account plugins.9# Binary account plugins.
10plugin_LTLIBRARIES = \10plugin_LTLIBRARIES = \
11 libfacebook.la \
12 libflickr.la \
11 libgeneric-oauth.la \13 libgeneric-oauth.la \
12 libgoogle.la14 libgoogle.la \
15 libtwitter.la
1316
14VALAFLAGS = \17VALAFLAGS = \
15 --vapidir $(top_srcdir)/src \18 --vapidir $(top_srcdir)/src \
@@ -36,12 +39,32 @@
36 -no-undefined \39 -no-undefined \
37 -export-symbols-regex '^ap_module_get_object_type'40 -export-symbols-regex '^ap_module_get_object_type'
3841
39libgoogle_la_CPPFLAGS = $(plugin_cppflags)42libfacebook_la_CPPFLAGS = $(plugin_cppflags) $(RESTAPIS_CFLAGS)
40libgoogle_la_LIBADD = $(plugin_libadd)43libfacebook_la_LIBADD = $(plugin_libadd) $(RESTAPIS_LIBS)
44libfacebook_la_LDFLAGS = $(plugin_ldflags)
45libfacebook_la_VALAFLAGS = --pkg libsoup-2.4 --pkg json-glib-1.0
46libfacebook_la_SOURCES = \
47 src/facebook.vala
48
49libflickr_la_CPPFLAGS = $(plugin_cppflags)
50libflickr_la_LIBADD = $(plugin_libadd)
51libflickr_la_LDFLAGS = $(plugin_ldflags)
52libflickr_la_SOURCES = \
53 src/flickr.vala
54
55libgoogle_la_CPPFLAGS = $(plugin_cppflags) $(RESTAPIS_CFLAGS)
56libgoogle_la_LIBADD = $(plugin_libadd) $(RESTAPIS_LIBS)
41libgoogle_la_LDFLAGS = $(plugin_ldflags)57libgoogle_la_LDFLAGS = $(plugin_ldflags)
58libgoogle_la_VALAFLAGS = --pkg libsoup-2.4 --pkg json-glib-1.0
42libgoogle_la_SOURCES = \59libgoogle_la_SOURCES = \
43 src/google.vala60 src/google.vala
4461
62libtwitter_la_CPPFLAGS = $(plugin_cppflags)
63libtwitter_la_LIBADD = $(plugin_libadd)
64libtwitter_la_LDFLAGS = $(plugin_ldflags)
65libtwitter_la_SOURCES = \
66 src/twitter.vala
67
45libgeneric_oauth_la_CPPFLAGS = $(plugin_cppflags)68libgeneric_oauth_la_CPPFLAGS = $(plugin_cppflags)
46libgeneric_oauth_la_LIBADD = $(plugin_libadd)69libgeneric_oauth_la_LIBADD = $(plugin_libadd)
47libgeneric_oauth_la_LDFLAGS = $(plugin_ldflags)70libgeneric_oauth_la_LDFLAGS = $(plugin_ldflags)
@@ -107,12 +130,9 @@
107 data/webkit-options/api.instagram.com.conf \130 data/webkit-options/api.instagram.com.conf \
108 data/webkit-options/api.weibo.com.conf \131 data/webkit-options/api.weibo.com.conf \
109 data/webkit-options/api.t.sohu.com.conf \132 data/webkit-options/api.t.sohu.com.conf \
110 data/webkit-options/api.twitter.com.conf \
111 data/webkit-options/foursquare.com.conf \133 data/webkit-options/foursquare.com.conf \
112 data/webkit-options/identi.ca.conf \134 data/webkit-options/identi.ca.conf \
113 data/webkit-options/login.live.com.conf \135 data/webkit-options/login.live.com.conf \
114 data/webkit-options/login.yahoo.com.conf \
115 data/webkit-options/www.facebook.com.conf \
116 data/webkit-options/www.linkedin.com.conf136 data/webkit-options/www.linkedin.com.conf
117137
118# Temporary until these bugs are fixed:138# Temporary until these bugs are fixed:
119139
=== modified file 'configure.ac'
--- configure.ac 2016-05-31 08:53:33 +0000
+++ configure.ac 2016-06-16 11:50:25 +0000
@@ -41,7 +41,10 @@
41 [have_libaccount_plugin=no])41 [have_libaccount_plugin=no])
4242
43AS_IF([test "x$have_libaccount_plugin" = "xyes"],43AS_IF([test "x$have_libaccount_plugin" = "xyes"],
44 [PKG_CHECK_MODULES([ACCOUNT_PLUGINS], [account-plugin >= 0.1.3])],44 [
45 PKG_CHECK_MODULES([ACCOUNT_PLUGINS], [account-plugin >= 0.1.3])
46 PKG_CHECK_MODULES([RESTAPIS], [libsoup-2.4 json-glib-1.0])
47 ],
45 [AS_IF([test "x$enable_libaccount_plugin" = "xyes"],48 [AS_IF([test "x$enable_libaccount_plugin" = "xyes"],
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])])])
4750
4851
=== modified file 'data/providers/facebook.provider.in.in'
--- data/providers/facebook.provider.in.in 2015-09-09 08:48:32 +0000
+++ data/providers/facebook.provider.in.in 2016-06-16 11:50:25 +0000
@@ -4,7 +4,7 @@
4 <icon>facebook</icon>4 <icon>facebook</icon>
5 <translations>account-plugins</translations>5 <translations>account-plugins</translations>
6 <domains>.*facebook\.com</domains>6 <domains>.*facebook\.com</domains>
7 <plugin>generic-oauth</plugin>7 <plugin>facebook</plugin>
8 <single-account>true</single-account>8 <single-account>true</single-account>
99
10 <template>10 <template>
1111
=== modified file 'data/providers/flickr.provider.in.in'
--- data/providers/flickr.provider.in.in 2013-02-25 06:25:34 +0000
+++ data/providers/flickr.provider.in.in 2016-06-16 11:50:25 +0000
@@ -4,7 +4,7 @@
4 <icon>flickr</icon>4 <icon>flickr</icon>
5 <translations>account-plugins</translations>5 <translations>account-plugins</translations>
6 <domains>.*flickr\.com</domains>6 <domains>.*flickr\.com</domains>
7 <plugin>generic-oauth</plugin>7 <plugin>flickr</plugin>
88
9 <template>9 <template>
10 <group name="auth">10 <group name="auth">
1111
=== modified file 'data/providers/mcloud.provider.in.in'
--- data/providers/mcloud.provider.in.in 2016-05-31 08:53:33 +0000
+++ data/providers/mcloud.provider.in.in 2016-06-16 11:50:25 +0000
@@ -9,18 +9,17 @@
9 <template>9 <template>
10 <group name="auth">10 <group name="auth">
11 <setting name="method">oauth2</setting>11 <setting name="method">oauth2</setting>
12 <setting name="mechanism">user_agent</setting>12 <setting name="mechanism">web_server</setting>
13 <group name="oauth2">13 <group name="oauth2">
14 <group name="user_agent">14 <group name="web_server">
15 <setting name="Host">caiyun.feixin.10086.cn</setting>15 <setting name="Host">caiyun.feixin.10086.cn</setting>
16 <setting name="AuthPath">authorize.jsp</setting>16 <setting name="AuthPath">authorize.jsp</setting>
17 <setting name="TokenPath">access_token</setting>17 <setting name="TokenPath">https://ose.caiyun.feixin.10086.cn/oauthApp/OAuth2/getToken</setting>
18 <setting name="RedirectUri">http://developer.ubuntu.com/en/</setting>18 <setting name="RedirectUri">http://developer.ubuntu.com/en/</setting>
19 <setting name="ResponseType">code</setting>19 <setting name="ResponseType">code</setting>
20 <setting name="ClientId">@MCLOUD_CLIENT_ID@</setting>20 <setting name="ClientId">@MCLOUD_CLIENT_ID@</setting>
21 <setting name="ClientSecret">@MCLOUD_CLIENT_SECRET@</setting>
21 <setting type="as" name="Scope">['nd_cloud']</setting> 22 <setting type="as" name="Scope">['nd_cloud']</setting>
22 <setting name="ForceClientAuthViaRequestBody" type="b">true</setting>
23 <setting name="DisableStateParameter" type="b">true</setting>
24 <setting type="as" name="AllowedSchemes">['https', 'http']</setting>23 <setting type="as" name="AllowedSchemes">['https', 'http']</setting>
25 </group>24 </group>
26 </group>25 </group>
2726
=== modified file 'data/providers/twitter.provider.in.in'
--- data/providers/twitter.provider.in.in 2013-02-22 15:17:49 +0000
+++ data/providers/twitter.provider.in.in 2016-06-16 11:50:25 +0000
@@ -3,7 +3,7 @@
3 <name>Twitter</name>3 <name>Twitter</name>
4 <icon>twitter</icon>4 <icon>twitter</icon>
5 <translations>account-plugins</translations>5 <translations>account-plugins</translations>
6 <plugin>generic-oauth</plugin>6 <plugin>twitter</plugin>
7 <domains>.*twitter\.com</domains>7 <domains>.*twitter\.com</domains>
88
9 <template>9 <template>
1010
=== removed file 'data/webkit-options/api.twitter.com.conf'
--- data/webkit-options/api.twitter.com.conf 2012-06-19 06:08:30 +0000
+++ data/webkit-options/api.twitter.com.conf 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
1UsernameField = input[id="username_or_email"]
2PasswordField = input[id="password"]
30
=== removed file 'data/webkit-options/login.yahoo.com.conf'
--- data/webkit-options/login.yahoo.com.conf 2012-06-18 14:24:03 +0000
+++ data/webkit-options/login.yahoo.com.conf 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
1UsernameField = input[name="login"]
2PasswordField = input[name="passwd"]
30
=== removed file 'data/webkit-options/www.facebook.com.conf'
--- data/webkit-options/www.facebook.com.conf 2012-05-02 22:58:29 +0000
+++ data/webkit-options/www.facebook.com.conf 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
1ViewportWidth = 420
2ViewportHeight = 320
3UsernameField = input[name="email"]
4PasswordField = input[name="pass"]
5#ZoomFactor = 2
6#PreferredWidth = 420
7
80
=== modified file 'debian/account-plugin-facebook.install'
--- debian/account-plugin-facebook.install 2015-04-17 08:53:11 +0000
+++ debian/account-plugin-facebook.install 2016-06-16 11:50:25 +0000
@@ -1,4 +1,3 @@
1etc/signon-ui/webkit-options.d/www.facebook.com.conf
2usr/share/accounts/services/facebook-sharing.service1usr/share/accounts/services/facebook-sharing.service
3usr/share/accounts/services/facebook-microblog.service2usr/share/accounts/services/facebook-microblog.service
4usr/share/accounts/providers/facebook.provider3usr/share/accounts/providers/facebook.provider
54
=== modified file 'debian/account-plugin-flickr.install'
--- debian/account-plugin-flickr.install 2014-03-31 08:21:46 +0000
+++ debian/account-plugin-flickr.install 2016-06-16 11:50:25 +0000
@@ -1,4 +1,3 @@
1etc/signon-ui/webkit-options.d/login.yahoo.com.conf
2usr/share/accounts/services/flickr-*.service1usr/share/accounts/services/flickr-*.service
3usr/share/accounts/providers/flickr.provider2usr/share/accounts/providers/flickr.provider
4usr/share/accounts/qml-plugins/flickr/Main.qml3usr/share/accounts/qml-plugins/flickr/Main.qml
54
=== modified file 'debian/account-plugin-twitter.install'
--- debian/account-plugin-twitter.install 2013-06-07 11:56:25 +0000
+++ debian/account-plugin-twitter.install 2016-06-16 11:50:25 +0000
@@ -1,4 +1,3 @@
1etc/signon-ui/webkit-options.d/api.twitter.com.conf
2usr/share/accounts/services/twitter-microblog.service1usr/share/accounts/services/twitter-microblog.service
3usr/share/accounts/providers/twitter.provider2usr/share/accounts/providers/twitter.provider
4usr/share/accounts/qml-plugins/twitter/Main.qml3usr/share/accounts/qml-plugins/twitter/Main.qml
54
=== modified file 'debian/changelog'
--- debian/changelog 2016-01-26 10:52:41 +0000
+++ debian/changelog 2016-06-16 11:50:25 +0000
@@ -1,3 +1,37 @@
1account-plugins (0.13+16.10.20160614-0ubuntu1) yakkety; urgency=medium
2
3 * debian/control:
4 Update package descriptions for all account plugins (LP: #1590786)
5
6 -- Alberto Mardegan <mardy@users.sourceforge.net> Tue, 14 Jun 2016 09:07:28 +0000
7
8account-plugins (0.13+16.10.20160608-0ubuntu1) yakkety; urgency=medium
9
10 [ Alberto Mardegan ]
11 * Add account plugin for vk.com (LP: #1564883)
12 * Add ownCloud plugin (LP: #1570986)
13
14 -- David Barth <david.barth@canonical.com> Wed, 08 Jun 2016 12:09:10 +0000
15
16account-plugins (0.13+16.04.20160405-0ubuntu1) xenial; urgency=medium
17
18 [ Alberto Mardegan ]
19 * After the authentication, retrieve the username in Google, Facebook,
20 Flickr and Twitter plugins (LP: #1565772)
21 * debian/control, debian/libaccount-plugin-facebook.install,
22 debian/libaccount-plugin-flickr.install,
23 debian/libaccount-plugin-twitter.install:
24 add packages containing plugin modules.
25 * debian/account-plugin-facebook.install,
26 debian/account-plugin-flickr.install,
27 debian/account-plugin-twitter.install:
28 remove unneeded webkit-options files.
29
30 [ CI Train Bot ]
31 * No-change rebuild.
32
33 -- David Barth <david.barth@canonical.com> Tue, 05 Apr 2016 12:57:47 +0000
34
1account-plugins (0.12+16.04.20160126-0ubuntu1) xenial; urgency=medium35account-plugins (0.12+16.04.20160126-0ubuntu1) xenial; urgency=medium
236
3 [ Alberto Mardegan ]37 [ Alberto Mardegan ]
438
=== modified file 'debian/control'
--- debian/control 2016-05-31 08:53:33 +0000
+++ debian/control 2016-06-16 11:50:25 +0000
@@ -7,9 +7,11 @@
7 gobject-introspection,7 gobject-introspection,
8 python3,8 python3,
9 pkg-config,9 pkg-config,
10 libaccount-plugin-1.0-dev (>= 0.1.9),
10 libaccounts-glib-dev (>= 1.10),11 libaccounts-glib-dev (>= 1.10),
12 libjson-glib-dev,
11 libsignon-glib-dev,13 libsignon-glib-dev,
12 libaccount-plugin-1.0-dev (>= 0.1.3),14 libsoup2.4-dev,
13 valac (>= 0.16),15 valac (>= 0.16),
14 gnome-common,16 gnome-common,
15 dh-autoreconf,17 dh-autoreconf,
@@ -24,125 +26,151 @@
24Architecture: any26Architecture: any
25Depends: ${shlibs:Depends}, ${misc:Depends},27Depends: ${shlibs:Depends}, ${misc:Depends},
26 signon-plugin-oauth2,28 signon-plugin-oauth2,
27Replaces: account-plugin-generic-oauth (<< 0.10bzr13.04.30)29Conflicts: account-plugin-windows-live,
28Breaks: account-plugin-generic-oauth (<< 0.10bzr13.04.30)30Description: Online account plugin support lib for Unity 7 - generic OAuth
29Conflicts: account-plugin-generic-oauth (<< 0.10bzr13.04.30),31 Support library for the Unity 7 OAuth-based online account plugins
30 account-plugin-windows-live,
31Description: GNOME Control Center account plugin for single signon - generic OAuth
32 GNOME Control Center account plugins for single signon
3332
34Package: libaccount-plugin-google33Package: libaccount-plugin-google
35Architecture: any34Architecture: any
36Depends: ${shlibs:Depends}, ${misc:Depends},35Depends: ${shlibs:Depends}, ${misc:Depends},
37 signon-plugin-oauth2,36 signon-plugin-oauth2,
38Replaces: account-plugin-google (<< 0.10bzr13.04.30)37Description: Online account plugin support lib for Unity 7 - Google
39Breaks: account-plugin-google (<< 0.10bzr13.04.30)38 Support library for the Unity 7 online account plugin
40Conflicts: account-plugin-google (<< 0.10bzr13.04.30)
41Description: GNOME Control Center account plugin for single signon - Google Auth
42 GNOME Control Center account plugins for single signon
4339
44Package: account-plugin-google40Package: account-plugin-google
45Architecture: all41Architecture: all
46Depends: ${shlibs:Depends}, ${misc:Depends},42Depends: ${shlibs:Depends}, ${misc:Depends},
47 libaccount-plugin-google | ubuntu-system-settings-online-accounts,43 libaccount-plugin-google | ubuntu-system-settings-online-accounts,
48 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),44 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
49Description: GNOME Control Center account plugin for single signon45Description: Online account plugin for Unity - Google
50 GNOME Control Center account plugins for single signon46 This plugin adds support for creating Google accounts in the Unity Control
47 Center
48
49Package: libaccount-plugin-facebook
50Architecture: any
51Depends: ${shlibs:Depends}, ${misc:Depends},
52 signon-plugin-oauth2,
53Description: Online account plugin support lib for Unity 7 - Facebook
54 Support library for the Unity 7 online account plugin
5155
52Package: account-plugin-facebook56Package: account-plugin-facebook
53Architecture: all57Architecture: all
54Depends: ${misc:Depends},58Depends: ${misc:Depends},
55 libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts,59 libaccount-plugin-facebook | ubuntu-system-settings-online-accounts,
56 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),60 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
57Description: GNOME Control Center account plugin for single signon - facebook61Description: Online account plugin for Unity - Facebook
58 GNOME Control Center account plugins for single signon62 This plugin adds support for creating Facebook accounts in the Unity Control
63 Center
64
65Package: libaccount-plugin-twitter
66Architecture: any
67Depends: ${shlibs:Depends}, ${misc:Depends},
68 signon-plugin-oauth2,
69Description: Online account plugin support lib for Unity 7 - Twitter
70 Support library for the Unity 7 online account plugin
5971
60Package: account-plugin-twitter72Package: account-plugin-twitter
61Architecture: all73Architecture: all
62Depends: ${misc:Depends},74Depends: ${misc:Depends},
63 libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts,75 libaccount-plugin-twitter | ubuntu-system-settings-online-accounts,
64 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),76 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
65Description: GNOME Control Center account plugin for single signon - twitter77Description: Online account plugin for Unity - Twitter
66 GNOME Control Center account plugins for single signon78 This plugin adds support for creating Twitter accounts in the Unity Control
79 Center
80
81Package: libaccount-plugin-flickr
82Architecture: any
83Depends: ${shlibs:Depends}, ${misc:Depends},
84 signon-plugin-oauth2,
85Description: Online account plugin support lib for Unity 7 - Flickr
86 Support library for the Unity 7 online account plugin
6787
68Package: account-plugin-flickr88Package: account-plugin-flickr
69Architecture: all89Architecture: all
70Depends: ${misc:Depends},90Depends: ${misc:Depends},
71 libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts,91 libaccount-plugin-flickr | ubuntu-system-settings-online-accounts,
72 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),92 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
73Description: GNOME Control Center account plugin for single signon - flickr93Description: Online account plugin for Unity - Flickr
74 GNOME Control Center account plugins for single signon94 This plugin adds support for creating Flickr accounts in the Unity Control
95 Center
7596
76Package: account-plugin-identica97Package: account-plugin-identica
77Architecture: all98Architecture: all
78Depends: ${misc:Depends},99Depends: ${misc:Depends},
79 libaccount-plugin-generic-oauth,100 libaccount-plugin-generic-oauth,
80 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),101 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
81Description: GNOME Control Center account plugin for single signon - identica102Description: Online account plugin for Unity - identi.ca
82 GNOME Control Center account plugins for single signon103 This plugin adds support for creating identi.ca accounts in the Unity Control
104 Center
83105
84Package: account-plugin-foursquare106Package: account-plugin-foursquare
85Architecture: all107Architecture: all
86Depends: ${misc:Depends},108Depends: ${misc:Depends},
87 libaccount-plugin-generic-oauth,109 libaccount-plugin-generic-oauth,
88 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),110 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
89Description: GNOME Control Center account plugin for single signon - foursquare111Description: Online account plugin for Unity - FourSquare
90 GNOME Control Center account plugins for single signon112 This plugin adds support for creating FourSquare accounts in the Unity
113 Control Center
91114
92Package: account-plugin-sohu115Package: account-plugin-sohu
93Architecture: all116Architecture: all
94Depends: ${misc:Depends},117Depends: ${misc:Depends},
95 libaccount-plugin-generic-oauth,118 libaccount-plugin-generic-oauth,
96 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),119 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
97Description: GNOME Control Center account plugin for single signon - sohu120Description: Online account plugin for Unity - Sohu
98 GNOME Control Center account plugins for single signon121 This plugin adds support for creating Sohu accounts in the Unity Control
122 Center
99123
100Package: account-plugin-sina124Package: account-plugin-sina
101Architecture: all125Architecture: all
102Depends: ${misc:Depends},126Depends: ${misc:Depends},
103 libaccount-plugin-generic-oauth,127 libaccount-plugin-generic-oauth,
104 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),128 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
105Description: GNOME Control Center account plugin for single signon - sina129Description: Online account plugin for Unity - Sina
106 GNOME Control Center account plugins for single signon130 This plugin adds support for creating Sina accounts in the Unity Control
131 Center
107132
108Package: account-plugin-linkedin133Package: account-plugin-linkedin
109Architecture: all134Architecture: all
110Depends: ${misc:Depends},135Depends: ${misc:Depends},
111 libaccount-plugin-generic-oauth,136 libaccount-plugin-generic-oauth,
112 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),137 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
113Description: GNOME Control Center account plugin for single signon - LinkedIn138Description: Online account plugin for Unity - LinkedIn
114 GNOME Control Center account plugins for single signon139 This plugin adds support for creating LinkedIn accounts in the Unity Control
140 Center
115141
116Package: account-plugin-instagram142Package: account-plugin-instagram
117Architecture: all143Architecture: all
118Depends: ${misc:Depends},144Depends: ${misc:Depends},
119 libaccount-plugin-generic-oauth,145 libaccount-plugin-generic-oauth,
120 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),146 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
121Description: GNOME Control Center account plugin for single signon - Instagram147Description: Online account plugin for Unity - Instagram
122 GNOME Control Center account plugins for single signon148 This plugin adds support for creating Instagram accounts in the Unity Control
149 Center
123150
124Package: account-plugin-mcloud151Package: account-plugin-mcloud
125Architecture: all152Architecture: all
126Depends: ${misc:Depends},153Depends: ${misc:Depends},
127 ubuntu-system-settings-online-accounts,154 ubuntu-system-settings-online-accounts,
128Description: Account plugin for online accounts - mCloud155Description: Online account plugin for Unity - mCloud
129 Online Accounts plugin provide the user interface to create accounts for156 This plugin adds support for creating mCloud accounts in the Unity Control
130 third party services.157 Center
131158
132Package: account-plugin-owncloud159Package: account-plugin-owncloud
133Architecture: all160Architecture: all
134Depends: ${misc:Depends},161Depends: ${misc:Depends},
135 ubuntu-system-settings-online-accounts,162 ubuntu-system-settings-online-accounts,
136Description: Account plugin for online accounts - ownCloud163Description: Online account plugin for Unity - ownCloud
137 Online Accounts plugin provide the user interface to create accounts for164 This plugin adds support for creating ownCloud accounts in the Unity Control
138 third party services.165 Center
139166
140Package: account-plugin-vk167Package: account-plugin-vk
141Architecture: all168Architecture: all
142Depends: ${misc:Depends},169Depends: ${misc:Depends},
143 libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts,170 libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts,
144Description: GNOME Control Center account plugin for single signon - VKontakte171Description: Online account plugin for Unity - VKontakte
145 GNOME Control Center account plugins for single signon172 This plugin adds support for creating VKontakte accounts in the Unity Control
173 Center
146174
147Package: account-plugin-tools175Package: account-plugin-tools
148Architecture: all176Architecture: all
@@ -154,12 +182,5 @@
154 gir1.2-accounts-1.0,182 gir1.2-accounts-1.0,
155 signon-plugin-oauth2,183 signon-plugin-oauth2,
156 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),184 unity-asset-pool (>> 0.8.24daily12.12.05-0ubuntu1),
157Description: GNOME Control Center account plugins for single signon - tools185Description: Online account plugins for Unity - tools
158 GNOME Control Center account plugins for single signon186 Command line tools for managing Online Accounts.
159
160Package: account-plugin-icons
161Depends: unity-asset-pool, ${misc:Depends}
162Architecture: all
163Section: oldlibs
164Description: transitional dummy package
165 This is a transitional dummy package. It can safely be removed.
166187
=== added file 'debian/libaccount-plugin-facebook.install'
--- debian/libaccount-plugin-facebook.install 1970-01-01 00:00:00 +0000
+++ debian/libaccount-plugin-facebook.install 2016-06-16 11:50:25 +0000
@@ -0,0 +1,1 @@
1usr/lib/libaccount-plugin-1.0/providers/libfacebook.so
02
=== added file 'debian/libaccount-plugin-flickr.install'
--- debian/libaccount-plugin-flickr.install 1970-01-01 00:00:00 +0000
+++ debian/libaccount-plugin-flickr.install 2016-06-16 11:50:25 +0000
@@ -0,0 +1,1 @@
1usr/lib/libaccount-plugin-1.0/providers/libflickr.so
02
=== added file 'debian/libaccount-plugin-twitter.install'
--- debian/libaccount-plugin-twitter.install 1970-01-01 00:00:00 +0000
+++ debian/libaccount-plugin-twitter.install 2016-06-16 11:50:25 +0000
@@ -0,0 +1,1 @@
1usr/lib/libaccount-plugin-1.0/providers/libtwitter.so
02
=== modified file 'qml/Makefile.am'
--- qml/Makefile.am 2016-04-18 12:06:17 +0000
+++ qml/Makefile.am 2016-06-16 11:50:25 +0000
@@ -2,6 +2,7 @@
2 facebook/Main.qml \2 facebook/Main.qml \
3 flickr/Main.qml \3 flickr/Main.qml \
4 google/Main.qml \4 google/Main.qml \
5 mcloud/Main.qml \
5 owncloud/Main.qml \6 owncloud/Main.qml \
6 owncloud/NewAccount.qml \7 owncloud/NewAccount.qml \
7 twitter/Main.qml \8 twitter/Main.qml \
89
=== removed file 'qml/mcloud/ErrorItem.qml'
--- qml/mcloud/ErrorItem.qml 2016-05-31 08:53:33 +0000
+++ qml/mcloud/ErrorItem.qml 1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
1/*
2 * Copyright (C) 2015 Canonical Ltd.
3 *
4 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 3, as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranties of
12 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13 * PURPOSE. See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.0
20import Ubuntu.Components 0.1
21import Ubuntu.Components.ListItems 0.1 as ListItem
22
23Item {
24 id: root
25
26 signal retryRequested()
27
28 Column {
29 anchors {
30 verticalCenter: parent.verticalCenter
31 left: parent.left; right: parent.right
32 }
33 spacing: units.gu(2)
34
35 Label {
36 anchors { left: parent.left; right: parent.right }
37 text: i18n.dtr("ubuntu-system-settings-online-accounts", "This service is not available right now. Try again later.")
38 wrapMode: Text.WordWrap
39 horizontalAlignment: Text.AlignHCenter
40 }
41
42 Button {
43 anchors.horizontalCenter: parent.horizontalCenter
44 text: i18n.dtr("ubuntu-system-settings-online-accounts", "Try Again")
45 onClicked: root.retryRequested()
46 }
47 }
48}
490
=== modified file 'qml/mcloud/Main.qml'
--- qml/mcloud/Main.qml 2016-05-31 08:53:33 +0000
+++ qml/mcloud/Main.qml 2016-06-16 11:50:25 +0000
@@ -1,7 +1,6 @@
1import Ubuntu.OnlineAccounts.Plugin 1.01import Ubuntu.OnlineAccounts.Plugin 1.0
2import "." as Local
32
4OAuthMain {3OAuthMain {
5 creationComponent: Local.OAuth {4 creationComponent: OAuth {
6 }5 }
7}6}
87
=== removed file 'qml/mcloud/OAuth.qml'
--- qml/mcloud/OAuth.qml 2016-05-31 08:53:33 +0000
+++ qml/mcloud/OAuth.qml 1970-01-01 00:00:00 +0000
@@ -1,283 +0,0 @@
1/*
2 * Copyright (C) 2013-2016 Canonical Ltd.
3 *
4 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 3, as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranties of
12 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13 * PURPOSE. See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.0
20import Ubuntu.Components 1.3
21import Ubuntu.Components.ListItems 1.3 as ListItem
22import Ubuntu.Components.Popups 1.3
23import Ubuntu.OnlineAccounts 0.1
24import Ubuntu.OnlineAccounts.Plugin 1.0
25
26Item {
27 id: root
28
29 /* To override the parameters coming from the .provider file: */
30 property variant authenticationParameters: {}
31 /* To override the default access control list: */
32 property variant accessControlList: ["unconfined"]
33
34 property variant authReply
35 property bool isNewAccount: false
36 property variant __account: account
37 property bool __isAuthenticating: false
38 property alias globalAccountService: globalAccountSettings
39 property bool loading: loader.status == Loader.Null || loader.status == Loader.Loading
40
41 signal authenticated(variant reply)
42 signal authenticationError(variant error)
43 signal finished
44
45 anchors.fill: parent
46
47 Component.onCompleted: {
48 isNewAccount = (account.accountId === 0)
49 enableAccount()
50 authenticate()
51 }
52
53 RequestHandler {
54 id: requestHandler
55 onRequestChanged: {
56 if (request) {
57 console.log("RequestHandler captured request!")
58 loader.setSource("WebView.qml", {
59 "signonRequest": request
60 })
61 } else {
62 console.log("Request destroyed!")
63 loader.source = ""
64 }
65 }
66 }
67
68 Credentials {
69 id: creds
70 caption: account.provider.id
71 acl: accessControlList
72 onCredentialsIdChanged: root.credentialsStored()
73 }
74
75 AccountService {
76 id: globalAccountSettings
77 objectHandle: account.accountServiceHandle
78 credentials: creds
79 autoSync: false
80
81 onAuthenticated: {
82 __isAuthenticating = false
83 authReply = reply
84 root.authenticated(reply)
85 }
86 onAuthenticationError: {
87 __isAuthenticating = false
88 root.authenticationError(error)
89 }
90 }
91
92 AccountServiceModel {
93 id: accountServices
94 includeDisabled: true
95 account: __account.objectHandle
96 }
97
98 ListItem.Base {
99 visible: loading && !errorItem.visible
100 height: units.gu(7)
101 showDivider: false
102 anchors.top: parent.top
103
104 Item {
105 height: units.gu(5)
106 width: units.gu(30)
107 anchors.horizontalCenter: parent.horizontalCenter
108 anchors.top: parent.top
109 anchors.margins: units.gu(1)
110
111 ActivityIndicator {
112 id: loadingIndicator
113 anchors.verticalCenter: parent.verticalCenter
114 anchors.left: parent.left
115 anchors.leftMargin: units.gu(5)
116 running: loading
117 z: 1
118 }
119 Label {
120 text: i18n.dtr("ubuntu-system-settings-online-accounts", "Loading…")
121 anchors.verticalCenter: parent.verticalCenter
122 anchors.left: loadingIndicator.right
123 anchors.leftMargin: units.gu(3)
124 }
125 }
126 }
127
128 Loader {
129 id: loader
130 anchors {
131 top: parent.top
132 left: parent.left
133 right: parent.right
134 bottom: Qt.inputMethod.visible ? osk.top : cancelButton.top
135 }
136 focus: true
137 visible: !loading
138 }
139
140 ErrorItem {
141 id: errorItem
142 anchors { fill: parent; margins: units.gu(4) }
143 visible: false
144 onRetryRequested: {
145 root.credentialsStored()
146 visible = false
147 }
148 }
149
150 KeyboardRectangle {
151 id: osk
152 }
153
154 ListItem.SingleControl {
155 id: cancelButton
156 anchors.bottom: parent.bottom
157 showDivider: false
158 control: Button {
159 text: i18n.dtr("ubuntu-system-settings-online-accounts", "Cancel")
160 width: parent.width - units.gu(4)
161 onClicked: root.cancel()
162 }
163 }
164
165 AccountServiceModel {
166 id: possiblyDuplicateAccounts
167 service: "global"
168 provider: __account.provider.id
169 }
170
171 function authenticate() {
172 console.log("Authenticating...")
173 creds.sync()
174 }
175
176 function credentialsStored() {
177 console.log("Credentials stored, id: " + creds.credentialsId)
178 if (creds.credentialsId == 0) return
179 var parameters = {}
180 parameters[requestHandler.matchKey] = requestHandler.matchId
181 parameters["providerId"] = account.provider.id
182 for (var p in authenticationParameters) {
183 parameters[p] = authenticationParameters[p]
184 }
185 __isAuthenticating = true
186 globalAccountSettings.authenticate(parameters)
187 }
188
189 function cancel() {
190 if (__isAuthenticating) {
191 /* This will cause the authentication to fail, and this method will
192 * be invoked again to delete the credentials. */
193 globalAccountSettings.cancelAuthentication()
194 return
195 }
196 if (isNewAccount && creds.credentialsId != 0) {
197 console.log("Removing credentials...")
198 creds.remove()
199 creds.removed.connect(finished)
200 } else {
201 finished()
202 }
203 }
204
205 function enableAccount() {
206 globalAccountSettings.updateServiceEnabled(true)
207 }
208
209 function getUserName(reply, callback) {
210 /* This should work for OAuth 1.0a; for OAuth 2.0 this function needs
211 * to be reimplemented */
212 if ('ScreenName' in reply) return reply.ScreenName
213 else if ('UserId' in reply) return reply.UserId
214 return ''
215 }
216
217 function accountIsDuplicate(userName) {
218 var model = possiblyDuplicateAccounts
219 for (var i = 0; i < model.count; i++) {
220 if (model.get(i, "displayName") == userName)
221 return true
222 }
223 return false
224 }
225
226 function __gotUserName(userName, reply) {
227 console.log("UserName: " + userName)
228 if (userName != '') {
229 if (accountIsDuplicate(userName)) {
230 var dialog = PopupUtils.open(Qt.resolvedUrl("DuplicateAccount.qml"))
231 dialog.closed.connect(cancel)
232 return
233 }
234 account.updateDisplayName(userName)
235 }
236 beforeSaving(reply)
237 }
238
239 function saveAccount() {
240 account.synced.connect(finished)
241 account.sync()
242 }
243
244 /* reimplement this function in plugins in order to perform some actions
245 * before quitting the plugin */
246 function beforeSaving(reply) {
247 saveAccount()
248 }
249
250 function __getUserNameAndSave(reply) {
251 /* If the completeCreation function is defined, run it */
252 if (typeof(completeCreation) == "function") {
253 console.warn("The completeCreation method is deprecated; use getUserName() or beforeSaving() instead")
254 completeCreation(reply)
255 return
256 }
257
258 var userName = getUserName(reply, function(name) {
259 __gotUserName(name, reply)
260 })
261 if (typeof(userName) == "string") {
262 __gotUserName(userName, reply)
263 } else if (userName === false) {
264 cancel()
265 return
266 }
267 // otherwise (userName === true), wait for the callback to be invoked
268 }
269
270 onAuthenticated: __getUserNameAndSave(reply)
271
272 onAuthenticationError: {
273 console.log("Authentication error, code " + error.code)
274 if (error.code == AccountService.NetworkError) {
275 console.log("Network error")
276 errorItem.visible = true
277 return
278 }
279 root.cancel()
280 }
281
282 onFinished: loading = false
283}
2840
=== removed file 'qml/mcloud/WebView.qml'
--- qml/mcloud/WebView.qml 2016-05-31 08:53:33 +0000
+++ qml/mcloud/WebView.qml 1970-01-01 00:00:00 +0000
@@ -1,94 +0,0 @@
1import QtQuick 2.0
2import Ubuntu.Components 1.1
3import Ubuntu.Web 0.2
4
5WebView {
6 id: root
7
8 property QtObject signonRequest
9 readonly property string token_url: "https://ose.caiyun.feixin.10086.cn/oauthApp/OAuth2/getToken"
10 readonly property string redirect_url: "http://developer.ubuntu.com/en/"
11 readonly property string client_id: "APP1ZtqoN3R0002"
12 readonly property string client_pass: "A70EFCDC91456349E7FDECF0A33574AC"
13
14 Component.onCompleted: {
15 signonRequest.authenticated.connect(onAuthenticated)
16 url = signonRequest.startUrl
17 }
18
19 //1.WORKAROUND: we need to retrieve refresh token instead of access token.
20 function fetchRefreshToken(code) {
21 var http = new XMLHttpRequest()
22 var body = "grant_type=authorization_code&code="+code+"&redirect_uri="+redirect_url
23
24 http.open("POST", token_url, true);
25 http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
26 http.setRequestHeader("Authorization", "Basic " + Qt.btoa(client_id + ":" + client_pass));
27 http.onreadystatechange = function() {
28 if (http.readyState === 4 && http.status == 200) {
29 var response = JSON.parse(http.responseText)
30 //create a fake access_token with refresh token.
31 var urlStr = redirect_url+"#access_token="+response.refresh_token
32 var authUrl = Qt.resolvedUrl(urlStr);
33 signonRequest.currentUrl = authUrl
34 } else {
35 console.log("error: " + http.status)
36 }
37 };
38
39 http.send(body);
40 }
41
42 onLoadingStateChanged: {
43 if (loading) {
44 signonRequest.onLoadStarted()
45 } else if (lastLoadSucceeded) {
46 signonRequest.onLoadFinished(true)
47 } else {
48 signonRequest.onLoadFinished(false)
49 }
50 }
51
52 onUrlChanged: {
53 //2.WORKAROUND: retrieve refresh token if code is fetched
54 var code_pattern= new RegExp("\\?code=.*&");
55 var urlStr = url.toString()
56 if (code_pattern.test(urlStr)){
57 var code = urlStr.match(/\?code=(.*)&/)[1];
58 console.log("code::", code)
59 fetchRefreshToken(code)
60 } else {
61 signonRequest.currentUrl = url
62 }
63 }
64
65 //3.WORKAROUND: Apply desktop useragent to prevent server from detecting android client,
66 //which causes authentication failure.
67 context: WebContext {
68 dataPath: signonRequest ? signonRequest.rootDir : ""
69 userAgent: "Mozilla/5.0 (Linux; Ubuntu 14.04) AppleWebKit/537.36 Chromium/35.0.1870.2 Safari/537.36"
70 }
71
72 function onAuthenticated() {
73 /* Get the cookies and set them on the request */
74 console.log("Authenticated; getting cookies")
75 context.cookieManager.getCookiesResponse.connect(onGotCookies)
76 context.cookieManager.getAllCookies()
77 visible = false
78 }
79
80 function onGotCookies(requestId, cookies) {
81 signonRequest.setCookies(cookies)
82 }
83
84 /* Taken from webbrowser-app */
85 ProgressBar {
86 anchors.top: parent.top
87 anchors.left: parent.left
88 anchors.right: parent.right
89 height: units.dp(3)
90 showProgressPercentage: false
91 visible: root.loading
92 value: root.loadProgress / 100
93 }
94}
950
=== added file 'src/facebook.vala'
--- src/facebook.vala 1970-01-01 00:00:00 +0000
+++ src/facebook.vala 2016-06-16 11:50:25 +0000
@@ -0,0 +1,69 @@
1/*
2 * Copyright (C) 2016 Canonical, Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
16 * USA.
17 *
18 * Authors:
19 * Alberto Mardegan <alberto.mardegan@canonical.com>
20 */
21
22public class FacebookPlugin : Ap.OAuthPlugin {
23 private Soup.Session session;
24
25 public FacebookPlugin (Ag.Account account) {
26 Object (account: account);
27 }
28
29 private void fetch_username (string access_token) {
30 debug ("fetching username, AT = " + access_token);
31 Soup.URI destination_uri =
32 new Soup.URI ("https://graph.facebook.com/me?access_token=" +
33 access_token);
34 var message = new Soup.Message.from_uri ("GET", destination_uri);
35 session = new Soup.Session ();
36 session.queue_message (message, (sess, msg) => {
37 debug ("Got message reply");
38 string body = (string) msg.response_body.data;
39 Json.Parser parser = new Json.Parser ();
40 try {
41 parser.load_from_data (body);
42
43 Json.Node root = parser.get_root ();
44 Json.Object response_object = root.get_object ();
45 var username = response_object.get_string_member ("name");
46 account.set_display_name (username);
47 } catch (Error error) {
48 warning ("Could not parse reply: " + body);
49 }
50
51 store_account ();
52 });
53 }
54
55 protected override void query_username () {
56 var reply = get_oauth_reply ();
57 Variant? v_token = reply.lookup_value ("AccessToken", null);
58 if (v_token != null) {
59 fetch_username (v_token.get_string ());
60 } else {
61 store_account ();
62 }
63 }
64}
65
66public GLib.Type ap_module_get_object_type ()
67{
68 return typeof (FacebookPlugin);
69}
070
=== added file 'src/flickr.vala'
--- src/flickr.vala 1970-01-01 00:00:00 +0000
+++ src/flickr.vala 2016-06-16 11:50:25 +0000
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2016 Canonical, Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
16 * USA.
17 *
18 * Authors:
19 * Alberto Mardegan <alberto.mardegan@canonical.com>
20 */
21
22public class FlickrPlugin : Ap.OAuthPlugin {
23 public FlickrPlugin (Ag.Account account) {
24 Object (account: account);
25 }
26
27 protected override void query_username () {
28 var reply = get_oauth_reply ();
29 Variant? v_name = reply.lookup_value ("username", null);
30 if (v_name != null) {
31 account.set_display_name (v_name.get_string ());
32 }
33
34 store_account ();
35 }
36}
37
38public GLib.Type ap_module_get_object_type ()
39{
40 return typeof (FlickrPlugin);
41}
042
=== modified file 'src/google.vala'
--- src/google.vala 2013-06-06 13:16:51 +0000
+++ src/google.vala 2016-06-16 11:50:25 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2012 Canonical, Inc2 * Copyright (C) 2012-2016 Canonical, Inc
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as5 * it under the terms of the GNU General Public License version 2 as
@@ -20,6 +20,8 @@
20 */20 */
2121
22public class GooglePlugin : Ap.OAuthPlugin {22public class GooglePlugin : Ap.OAuthPlugin {
23 private Soup.Session session;
24
23 public GooglePlugin (Ag.Account account) {25 public GooglePlugin (Ag.Account account) {
24 Object (account: account);26 Object (account: account);
25 }27 }
@@ -44,6 +46,43 @@
4446
45 set_ignore_cookies (true);47 set_ignore_cookies (true);
46 }48 }
49
50 private void fetch_username (string access_token) {
51 debug ("fetching username, AT = " + access_token);
52 Soup.URI destination_uri =
53 new Soup.URI ("https://www.googleapis.com/oauth2/v3/userinfo");
54 var message = new Soup.Message.from_uri ("POST", destination_uri);
55 message.request_headers.append ("Authorization", "Bearer " + access_token);
56 message.request_headers.set_content_length (0);
57 session = new Soup.Session ();
58 session.queue_message (message, (sess, msg) => {
59 debug ("Got message reply");
60 string body = (string) msg.response_body.data;
61 Json.Parser parser = new Json.Parser ();
62 try {
63 parser.load_from_data (body);
64
65 Json.Node root = parser.get_root ();
66 Json.Object response_object = root.get_object ();
67 var username = response_object.get_string_member ("email");
68 account.set_display_name (username);
69 } catch (Error error) {
70 warning ("Could not parse reply: " + body);
71 }
72
73 store_account ();
74 });
75 }
76
77 protected override void query_username () {
78 var reply = get_oauth_reply ();
79 Variant? v_token = reply.lookup_value ("AccessToken", null);
80 if (v_token != null) {
81 fetch_username (v_token.get_string ());
82 } else {
83 store_account ();
84 }
85 }
47}86}
4887
49public GLib.Type ap_module_get_object_type ()88public GLib.Type ap_module_get_object_type ()
5089
=== added file 'src/twitter.vala'
--- src/twitter.vala 1970-01-01 00:00:00 +0000
+++ src/twitter.vala 2016-06-16 11:50:25 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2016 Canonical, Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
16 * USA.
17 *
18 * Authors:
19 * Alberto Mardegan <alberto.mardegan@canonical.com>
20 */
21
22public class TwitterPlugin : Ap.OAuthPlugin {
23 public TwitterPlugin (Ag.Account account) {
24 Object (account: account);
25 }
26
27 protected override void query_username () {
28 var reply = get_oauth_reply ();
29 Variant? v_name = reply.lookup_value ("ScreenName", null);
30 if (v_name != null) {
31 account.set_display_name (v_name.get_string ());
32 } else {
33 v_name = reply.lookup_value ("UserId", null);
34 if (v_name != null) {
35 account.set_display_name (v_name.get_string ());
36 }
37 }
38
39 store_account ();
40 }
41}
42
43public GLib.Type ap_module_get_object_type ()
44{
45 return typeof (TwitterPlugin);
46}

Subscribers

People subscribed via source and target branches

to all changes: