[Desktop-packages] [Bug 1237869] Re: invalid network proxy setting for oauth2

2013-10-10 Thread Wu Shu
BTW, I take a look at the latest signon-plugin-oauth2-0.17 for 13.10 but
the code is the same with 13.04. Hoping it's verified and fixed in
13.10.

Thanks,
Shu

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to signon-plugin-oauth2 in Ubuntu.
https://bugs.launchpad.net/bugs/1237869

Title:
  invalid network proxy setting for oauth2

Status in “signon-plugin-oauth2” package in Ubuntu:
  New

Bug description:
  1. I'm behind a company proxy, which only accept HTTP, HTTPS, FTP proxy 
settings. I've already have those set correctly.
  2. When I tried to add Google online account, I can get into Google's login 
and authorization page. But after I click Accept, the page becomes blank and 
no further action will be taken. No matter how long you wait or just cancel it, 
the account cannot be added.

  I've root caused the issue and will update it below.

  Can you folks take a look if it makes senses?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/signon-plugin-oauth2/+bug/1237869/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp


[Desktop-packages] [Bug 1237869] Re: invalid network proxy setting for oauth2

2013-10-10 Thread Wu Shu
Forgot to mention, this issue also affects Twitter online account. I can
only get a blank page when I chose to add the Twitter account, without
no any prompt/warnings.

My Analysis

1. I change loglevel of signond.conf and see the following from log:

Oct 10 10:46:01 kitt signonpluginprocess: plugin.cpp 126 userActionFinished :
Oct 10 10:46:01 kitt signonpluginprocess: oauth2plugin.cpp 310 
userActionFinished :
Oct 10 10:46:01 kitt signonpluginprocess: oauth2plugin.cpp 323 
userActionFinished : 
https://wiki.ubuntu.com/?code=4/PMaxsE1yzBrszLJyMbF0gyYhX_Sx.ouuTe7vG4m0XEnp6UAPFm0EAeYdAgwI;
Oct 10 10:46:01 kitt signonpluginprocess: oauth2plugin.cpp 566 
sendOAuth2PostRequest :
Oct 10 10:46:01 kitt signonpluginprocess: oauth2plugin.cpp 575 
sendOAuth2PostRequest : Query string =  
grant_type=authorization_codeclient_id=759250720802-4sii0me9963n9fdqdmi7cepn6ub8luoh.apps.googleusercontent.comclient_secret=juFngKUcuhB7IRQqHtSLavqJcode=4/PMaxsE1yzBrszLJyMbF0gyYhX_Sx.ouuTe7vG4m0XEnp6UAPFm0EAeYdAgwIredirect_uri=https://wiki.ubuntu.com/;
Oct 10 10:46:01 kitt signonpluginprocess: 
../../../../src/remotepluginprocess/remotepluginprocess.cpp 496 startTask 
operation is completed

After quite a whie:

Oct 10 10:51:06 kitt signonpluginprocess: base-plugin.cpp 151 
handleNetworkError : error signal received: 99 
Oct 10 10:51:06 kitt signonpluginprocess: 
../../../../src/remotepluginprocess/remotepluginprocess.cpp 425 
disableCancelThread Before the isFinished loop
Oct 10 10:51:06 kitt signonpluginprocess: 
../../../../src/remotepluginprocess/remotepluginprocess.cpp 430 
disableCancelThread Internal iteration  0
Oct 10 10:51:06 kitt signonpluginprocess: 
../../../../src/remotepluginprocess/remotepluginprocess.cpp 249 error error is 
sent 307   Connection to proxy closed prematurely 
Oct 10 10:51:06 kitt signonpluginprocess: base-plugin.cpp 133 onPostFinished : 
Finished signal received

So it appears the proxy isn't correctly used. But I did set the proxy
correctly and the previous steps can go on well. Also I can succeed in
adding Facebook account.

2. I added some logging in plugin.cpp and oauth2plugin.cpp and found the proxy 
in the QNetworkAccessManager is correctly:
proxy.foobar.com:3128. So it's really strange the connection cannot reach when 
proxy is correctly set. I tried to use Wireshark to see what happened but it's 
HTTPS so it's difficulty to do.

3. Then I accidentally commented the line in plugin.cpp:
void Plugin::process(const SignOn::SessionData inData, ...)
{
...
//m_networkAccessManager-setProxy(networkProxy);
impl-setNetworkAccessManager(m_networkAccessManager);
...
}
And found it worked! Both Google account and Twitter account are added.

4. From my experiences, I believe it's due to HTTPS over HTTP proxy. In
my company HTTPS should go to HTTPS proxy
(https://proxy.foobar.com:3128).

From the code in Plugin::process, the proxy is set to
QNetworkProxy::applicationProxy():

QNetworkProxy networkProxy = QNetworkProxy::applicationProxy();
m_networkAccessManager-setProxy(networkProxy);
impl-setNetworkAccessManager(m_networkAccessManager);

applicationProxy() will only return the HTTP proxy when the system proxy
has multiple proxy settings.

But why it worked if I don't set the proxy? I found in
remotepluginprocess.cpp (the signond package):

bool RemotePluginProcess::setupProxySettings()
{
...
MyNetworkProxyFactory *proxyFactory = new MyNetworkProxyFactory();
QNetworkProxyFactory::setApplicationProxyFactory(proxyFactory);
...
return true;
}

The signonpluginprocess has application proxy set, and it's a proxy
factory. This means the HTTPS proxy will be selected if you make an
HTTPS request.

5. My Fix

So I propose a fix for this issue. I'd like to set the proxy in plugin
to the default proxy, which will pick up the application proxy factory,
instead of selecting a steady HTTP proxy. I still keep the proxy
override for parameters. Can you help to verify and merge it if
necessary?

Thanks,
Shu


** Patch added: use-application-proxy.patch
   
https://bugs.launchpad.net/ubuntu/+source/signon-plugin-oauth2/+bug/1237869/+attachment/3871290/+files/use-application-proxy.patch

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to signon-plugin-oauth2 in Ubuntu.
https://bugs.launchpad.net/bugs/1237869

Title:
  invalid network proxy setting for oauth2

Status in “signon-plugin-oauth2” package in Ubuntu:
  New

Bug description:
  1. I'm behind a company proxy, which only accept HTTP, HTTPS, FTP proxy 
settings. I've already have those set correctly.
  2. When I tried to add Google online account, I can get into Google's login 
and authorization page. But after I click Accept, the page becomes blank and 
no further action will be taken. No matter how long you wait or just cancel it, 
the account cannot be added.

  I've root caused the issue and will update it below.

  Can you folks take a look if it 

[Desktop-packages] [Bug 1237869] Re: invalid network proxy setting for oauth2

2013-10-10 Thread Ubuntu Foundations Team Bug Bot
The attachment use-application-proxy.patch seems to be a patch.  If it
isn't, please remove the patch flag from the attachment, remove the
patch tag, and if you are a member of the ~ubuntu-reviewers,
unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by
~brian-murray, for any issues please contact him.]

** Tags added: patch

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to signon-plugin-oauth2 in Ubuntu.
https://bugs.launchpad.net/bugs/1237869

Title:
  invalid network proxy setting for oauth2

Status in “signon-plugin-oauth2” package in Ubuntu:
  New

Bug description:
  1. I'm behind a company proxy, which only accept HTTP, HTTPS, FTP proxy 
settings. I've already have those set correctly.
  2. When I tried to add Google online account, I can get into Google's login 
and authorization page. But after I click Accept, the page becomes blank and 
no further action will be taken. No matter how long you wait or just cancel it, 
the account cannot be added.

  I've root caused the issue and will update it below.

  Can you folks take a look if it makes senses?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/signon-plugin-oauth2/+bug/1237869/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp