Skip to content

Commit 918c47c

Browse files
committedMar 24, 2017
[bugfix][backport] Apply authentication configuration to xyz layers
1 parent 23e2202 commit 918c47c

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed
 

‎src/providers/wms/qgswmscapabilities.cpp

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ bool QgsWmsSettings::parseUri( const QString& uriString )
4141
QgsDataSourceURI uri;
4242
uri.setEncodedUri( uriString );
4343

44+
// Setup authentication
45+
mAuth.mUserName = uri.param( "username" );
46+
QgsDebugMsg( "set username to " + mAuth.mUserName );
47+
48+
mAuth.mPassword = uri.param( "password" );
49+
QgsDebugMsg( "set password to " + mAuth.mPassword );
50+
51+
if ( uri.hasParam( "authcfg" ) )
52+
{
53+
mAuth.mAuthCfg = uri.param( "authcfg" );
54+
}
55+
QgsDebugMsg( "set authcfg to " + mAuth.mAuthCfg );
56+
57+
mAuth.mReferer = uri.param( "referer" );
58+
QgsDebugMsg( "set referer to " + mAuth.mReferer );
59+
4460
mXyz = false; // assume WMS / WMTS
4561

4662
if ( uri.param( "type" ) == "xyz" )
@@ -54,10 +70,6 @@ bool QgsWmsSettings::parseUri( const QString& uriString )
5470
mMaxHeight = 0;
5571
mHttpUri = uri.param( "url" );
5672
mBaseUrl = mHttpUri;
57-
mAuth.mUserName.clear();
58-
mAuth.mPassword.clear();
59-
mAuth.mReferer.clear();
60-
mAuth.mAuthCfg.clear();
6173
mIgnoreGetMapUrl = false;
6274
mIgnoreGetFeatureInfoUrl = false;
6375
mSmoothPixmapTransform = true;
@@ -87,21 +99,6 @@ bool QgsWmsSettings::parseUri( const QString& uriString )
8799

88100
mDpiMode = uri.hasParam( "dpiMode" ) ? static_cast< QgsWmsDpiMode >( uri.param( "dpiMode" ).toInt() ) : dpiAll;
89101

90-
mAuth.mUserName = uri.param( "username" );
91-
QgsDebugMsg( "set username to " + mAuth.mUserName );
92-
93-
mAuth.mPassword = uri.param( "password" );
94-
QgsDebugMsg( "set password to " + mAuth.mPassword );
95-
96-
if ( uri.hasParam( "authcfg" ) )
97-
{
98-
mAuth.mAuthCfg = uri.param( "authcfg" );
99-
}
100-
QgsDebugMsg( "set authcfg to " + mAuth.mAuthCfg );
101-
102-
mAuth.mReferer = uri.param( "referer" );
103-
QgsDebugMsg( "set referer to " + mAuth.mReferer );
104-
105102
mActiveSubLayers = uri.params( "layers" );
106103
mActiveSubStyles = uri.params( "styles" );
107104
QgsDebugMsg( "Entering: layers:" + mActiveSubLayers.join( ", " ) + ", styles:" + mActiveSubStyles.join( ", " ) );

0 commit comments

Comments
 (0)
Please sign in to comment.