Skip to content

Commit

Permalink
[bugfix] 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 40f86b2 commit 8b0e3d8
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( 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" ) )
Expand All @@ -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;
Expand Down Expand Up @@ -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( ", " ) );
Expand Down

0 comments on commit 8b0e3d8

Please sign in to comment.