Skip to content
Permalink
Browse files
[bugfix] Apply authentication configuration to xyz layers
  • Loading branch information
elpaso committed Mar 24, 2017
1 parent 40f86b2 commit 8b0e3d8da3b98a0e6777234270a8ff02f9fc10ae
Showing with 16 additions and 19 deletions.
  1. +16 −19 src/providers/wms/qgswmscapabilities.cpp
@@ -41,6 +41,22 @@ bool QgsWmsSettings::parseUri( const QString &uriString )
QgsDataSourceUri uri;
uri.setEncodedUri( uriString );

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

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

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson Mar 24, 2017

Collaborator

Do we really want this output like this?

This comment has been minimized.

Copy link
@elpaso

elpaso Mar 24, 2017

Author Contributor

Well, I just moved up the existing code block, but I'm fine to remove all debug messages.


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

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

mXyz = false; // assume WMS / WMTS

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

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

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

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

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

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

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

0 comments on commit 8b0e3d8

Please sign in to comment.