Skip to content

Commit

Permalink
[WFS provider] Do not expand authentication config to username/passwo…
Browse files Browse the repository at this point in the history
…rd when adding layers from source select or browser
  • Loading branch information
rouault authored and nyalldawson committed Oct 26, 2019
1 parent 4fe285d commit e75343e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/providers/wfs/qgswfsdataitems.cpp
Expand Up @@ -191,7 +191,7 @@ QVector<QgsDataItem *> QgsWfsRootItem::createChildren()
{
QgsWfsConnection connection( connName );
QString path = "wfs:/" + connName;
QgsDataItem *conn = new QgsWfsConnectionItem( this, connName, path, connection.uri().uri() );
QgsDataItem *conn = new QgsWfsConnectionItem( this, connName, path, connection.uri().uri( false ) );
connections.append( conn );
}
return connections;
Expand Down Expand Up @@ -260,7 +260,7 @@ QgsDataItem *QgsWfsDataItemProvider::createDataItem( const QString &path, QgsDat

QgsDebugMsgLevel( QStringLiteral( "WFS full uri: '%1'." ).arg( QString( sourceUri.uri() ) ), 4 );

return new QgsWfsConnectionItem( parentItem, QStringLiteral( "WFS" ), path, sourceUri.uri( false ) );
return new QgsWfsConnectionItem( parentItem, QStringLiteral( "WFS" ), path, sourceUri.uri() );
}
}

Expand All @@ -287,9 +287,9 @@ QVector<QgsDataItem *> QgsWfsDataItemProvider::createDataItems( const QString &p
for ( const QString &encodedUri : encodedUris )
{
QgsWFSDataSourceURI uri( encodedUri );
QgsDebugMsgLevel( QStringLiteral( "WFS full uri: '%1'." ).arg( uri.uri( false ) ), 4 );
QgsDebugMsgLevel( QStringLiteral( "WFS full uri: '%1'." ).arg( uri.uri() ), 4 );

QgsDataItem *item = new QgsWfsConnectionItem( parentItem, QStringLiteral( "WFS" ), path, uri.uri( false ) );
QgsDataItem *item = new QgsWfsConnectionItem( parentItem, QStringLiteral( "WFS" ), path, uri.uri() );
if ( item )
{
items.append( item );
Expand Down
6 changes: 3 additions & 3 deletions src/providers/wfs/qgswfsdatasourceuri.cpp
Expand Up @@ -144,7 +144,7 @@ QgsWFSDataSourceURI::QgsWFSDataSourceURI( const QString &uri )
}
}

const QString QgsWFSDataSourceURI::uri( bool expandAuthConfig ) const
const QString QgsWFSDataSourceURI::uri() const
{
QgsDataSourceUri theURI( mURI );
// Add authcfg param back into the uri (must be non-empty value)
Expand All @@ -164,8 +164,8 @@ const QString QgsWFSDataSourceURI::uri( bool expandAuthConfig ) const
theURI.setPassword( mAuth.mPassword );
}
}
// NOTE: avoid expanding authcfg here; it is handled during network access
return theURI.uri( expandAuthConfig );
// NOTE: do not expand authcfg here; it is handled during network access
return theURI.uri( false );
}


Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfsdatasourceuri.h
Expand Up @@ -85,7 +85,7 @@ class QgsWFSDataSourceURI
explicit QgsWFSDataSourceURI( const QString &uri );

//! Returns the URI, avoiding expansion of authentication configuration, which is handled during network access
const QString uri( bool expandAuthConfig = false ) const;
const QString uri() const;

//! Returns base URL (with SERVICE=WFS parameter if bIncludeServiceWFS=true)
QUrl baseURL( bool bIncludeServiceWFS = true ) const;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfssourceselect.cpp
Expand Up @@ -404,7 +404,7 @@ void QgsWFSSourceSelect::addButtonClicked()
}
QgsDebugMsg( "Layer " + typeName + " SQL is " + sql );

mUri = QgsWFSDataSourceURI::build( connection.uri().uri(), typeName, pCrsString,
mUri = QgsWFSDataSourceURI::build( connection.uri().uri( false ), typeName, pCrsString,
sql, cbxFeatureCurrentViewExtent->isChecked() );

emit addVectorLayer( mUri, layerName );
Expand Down

0 comments on commit e75343e

Please sign in to comment.