Re: [Qgis-developer] How to change credentials using QgsCredentials and QgsNetworkAccessManager

2014-06-05 Thread Gino Pirelli
I Jürgen,

I did test without success... I don't know if you where able to manage
Manual vs Automatic attribute...

Probably this behaviour match this qt bug:
https://bugreports.qt-project.org/browse/QTBUG-16835

I would use QgsNetworkAccessManager to hide qgis proxy parameters

Regards

Luigi Pirelli (luigi.pire...@faunalia.it - lui...@gmail.com)



On 5 June 2014 08:15, Jürgen E.  wrote:

> Hi Gino,
>
> On Wed, 04. Jun 2014 at 19:46:07 +0200, Gino Pirelli wrote:
> > 7) auth is required by the server, but QNetwarkAccessManager use cached
> > credentials and NO signal AuthenticationRequired => it doesn't enter
> > in QgisApp::namAuthenticationRequired => no credential are requested and
> > continue with the old credentials
>
> Try setting the QNetworkRequest::AuthenticationReuseAttribute
> of your QNetworkRequest to QNetworkRequest::Manual.
>
>
> Jürgen
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] How to change credentials using QgsCredentials and QgsNetworkAccessManager

2014-06-04 Thread Jürgen E . Fischer
Hi Gino,

On Wed, 04. Jun 2014 at 19:46:07 +0200, Gino Pirelli wrote:
> 7) auth is required by the server, but QNetwarkAccessManager use cached
> credentials and NO signal AuthenticationRequired => it doesn't enter
> in QgisApp::namAuthenticationRequired => no credential are requested and
> continue with the old credentials

Try setting the QNetworkRequest::AuthenticationReuseAttribute
of your QNetworkRequest to QNetworkRequest::Manual.


Jürgen

-- 
Jürgen E. Fischer norBIT GmbH   Tel. +49-4931-918175-31
Dipl.-Inf. (FH)   Rheinstraße 13Fax. +49-4931-918175-50
Software Engineer D-26506 Norden   http://www.norbit.de
QGIS PSC member (RM)  Germany  IRC: jef on FreeNode 


-- 
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


[Qgis-developer] How to change credentials using QgsCredentials and QgsNetworkAccessManager

2014-06-04 Thread Gino Pirelli
Hi,

I'm trying to change credential after a successful login, but without
success, and I wonder it's not possible, so I ask to the community what's
I'm doing wrong.
The only way I found to login as new user is closing and opening again qgis
:|

the workflow it this one

first correct login

1) get a QgsNetworkAccessManager instance
2) prepare a request
3) auth is required by the server => QgisApp::namAuthenticationRequired is
called
4) in QgisApp::namAuthenticationRequired QgsCredential get(...) is used to
ask user and password that are set in the QAuthenticator

all proceed well... but at a moment my plugin need to be used by other
user, so next steps for a new requests are

5) get a QgsNetworkAccessManager instance
6) prepare a request
7) auth is required by the server, but QNetwarkAccessManager use cached
credentials and NO signal AuthenticationRequired => it doesn't enter
in QgisApp::namAuthenticationRequired => no credential are requested and
continue with the old credentials

QNetworkAccessManager reuse "old" QAutenticator so it is unuseful set new
credentials with QgsCredentials::instance().put(). QgsCredentials are get
only in QgisApp::namAuthenticationRequired that is called once (due the
fact that QgsNetworkAccessManager is singleton?)

next QT version (qt5) has a QNetorkAccessManager::clearAccessCache().
Method not available in QT4.

Should I use directly QNetworkAccessManager instead of then singleton
version forced by QgsNetworkAccessManager?

anyone know a way

Any help is appreciated,

Luigi Pirelli (luigi.pire...@faunalia.it - lui...@gmail.com)
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer