invalid network proxy setting for oauth2

Bug #1237869 reported by Wu Shu
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
signon-plugin-oauth2 (Ubuntu)
New
Undecided
Unassigned

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?

Tags: patch
Revision history for this message
Wu Shu (superwushu) wrote :
Download full text (3.9 KiB)

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_code&client_id=759250720802-4sii0me9963n9fdqdmi7cepn6ub8luoh.apps.googleusercontent.com&client_secret=juFngKUcuhB7IRQqHtSLavqJ&code=4/PMaxsE1yzBrszLJyMbF0gyYhX_Sx.ouuTe7vG4m0XEnp6UAPFm0EAeYdAgwI&redirect_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 p...

Read more...

Revision history for this message
Wu Shu (superwushu) wrote :

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

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

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
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.