Skip to content

Commit 8b0e3d8

Browse files
committedMar 24, 2017
[bugfix] Apply authentication configuration to xyz layers
1 parent 40f86b2 commit 8b0e3d8

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( QStringLiteral( "username" ) );
46+
QgsDebugMsg( "set username to " + mAuth.mUserName );
47+
48+
mAuth.mPassword = uri.param( QStringLiteral( "password" ) );
49+
QgsDebugMsg( "set password to " + mAuth.mPassword );
Code has comments. Press enter to view.
50+
51+
if ( uri.hasParam( QStringLiteral( "authcfg" ) ) )
52+
{
53+
mAuth.mAuthCfg = uri.param( QStringLiteral( "authcfg" ) );
54+
}
55+
QgsDebugMsg( "set authcfg to " + mAuth.mAuthCfg );
56+
57+
mAuth.mReferer = uri.param( QStringLiteral( "referer" ) );
58+
QgsDebugMsg( "set referer to " + mAuth.mReferer );
59+
4460
mXyz = false; // assume WMS / WMTS
4561

4662
if ( uri.param( QStringLiteral( "type" ) ) == QLatin1String( "xyz" ) )
@@ -54,10 +70,6 @@ bool QgsWmsSettings::parseUri( const QString &uriString )
5470
mMaxHeight = 0;
5571
mHttpUri = uri.param( QStringLiteral( "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( QStringLiteral( "dpiMode" ) ) ? static_cast< QgsWmsDpiMode >( uri.param( QStringLiteral( "dpiMode" ) ).toInt() ) : DpiAll;
89101

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

0 commit comments

Comments
 (0)
Please sign in to comment.