Skip to content

Commit

Permalink
[bugfix][backport] Apply authentication configuration to xyz layers
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Mar 24, 2017
1 parent 23e2202 commit 918c47c
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/providers/wms/qgswmscapabilities.cpp
Expand Up @@ -41,6 +41,22 @@ bool QgsWmsSettings::parseUri( const QString& uriString )
QgsDataSourceURI uri;
uri.setEncodedUri( uriString );

// Setup authentication
mAuth.mUserName = uri.param( "username" );
QgsDebugMsg( "set username to " + mAuth.mUserName );

mAuth.mPassword = uri.param( "password" );
QgsDebugMsg( "set password to " + mAuth.mPassword );

if ( uri.hasParam( "authcfg" ) )
{
mAuth.mAuthCfg = uri.param( "authcfg" );
}
QgsDebugMsg( "set authcfg to " + mAuth.mAuthCfg );

mAuth.mReferer = uri.param( "referer" );
QgsDebugMsg( "set referer to " + mAuth.mReferer );

mXyz = false; // assume WMS / WMTS

if ( uri.param( "type" ) == "xyz" )
Expand All @@ -54,10 +70,6 @@ bool QgsWmsSettings::parseUri( const QString& uriString )
mMaxHeight = 0;
mHttpUri = uri.param( "url" );
mBaseUrl = mHttpUri;
mAuth.mUserName.clear();
mAuth.mPassword.clear();
mAuth.mReferer.clear();
mAuth.mAuthCfg.clear();
mIgnoreGetMapUrl = false;
mIgnoreGetFeatureInfoUrl = false;
mSmoothPixmapTransform = true;
Expand Down Expand Up @@ -87,21 +99,6 @@ bool QgsWmsSettings::parseUri( const QString& uriString )

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

mAuth.mUserName = uri.param( "username" );
QgsDebugMsg( "set username to " + mAuth.mUserName );

mAuth.mPassword = uri.param( "password" );
QgsDebugMsg( "set password to " + mAuth.mPassword );

if ( uri.hasParam( "authcfg" ) )
{
mAuth.mAuthCfg = uri.param( "authcfg" );
}
QgsDebugMsg( "set authcfg to " + mAuth.mAuthCfg );

mAuth.mReferer = uri.param( "referer" );
QgsDebugMsg( "set referer to " + mAuth.mReferer );

mActiveSubLayers = uri.params( "layers" );
mActiveSubStyles = uri.params( "styles" );
QgsDebugMsg( "Entering: layers:" + mActiveSubLayers.join( ", " ) + ", styles:" + mActiveSubStyles.join( ", " ) );
Expand Down

0 comments on commit 918c47c

Please sign in to comment.