Skip to content

Commit e75343e

Browse files
rouaultnyalldawson
authored andcommittedOct 26, 2019
[WFS provider] Do not expand authentication config to username/password when adding layers from source select or browser
1 parent 4fe285d commit e75343e

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed
 

‎src/providers/wfs/qgswfsdataitems.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ QVector<QgsDataItem *> QgsWfsRootItem::createChildren()
191191
{
192192
QgsWfsConnection connection( connName );
193193
QString path = "wfs:/" + connName;
194-
QgsDataItem *conn = new QgsWfsConnectionItem( this, connName, path, connection.uri().uri() );
194+
QgsDataItem *conn = new QgsWfsConnectionItem( this, connName, path, connection.uri().uri( false ) );
195195
connections.append( conn );
196196
}
197197
return connections;
@@ -260,7 +260,7 @@ QgsDataItem *QgsWfsDataItemProvider::createDataItem( const QString &path, QgsDat
260260

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

263-
return new QgsWfsConnectionItem( parentItem, QStringLiteral( "WFS" ), path, sourceUri.uri( false ) );
263+
return new QgsWfsConnectionItem( parentItem, QStringLiteral( "WFS" ), path, sourceUri.uri() );
264264
}
265265
}
266266

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

292-
QgsDataItem *item = new QgsWfsConnectionItem( parentItem, QStringLiteral( "WFS" ), path, uri.uri( false ) );
292+
QgsDataItem *item = new QgsWfsConnectionItem( parentItem, QStringLiteral( "WFS" ), path, uri.uri() );
293293
if ( item )
294294
{
295295
items.append( item );

‎src/providers/wfs/qgswfsdatasourceuri.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ QgsWFSDataSourceURI::QgsWFSDataSourceURI( const QString &uri )
144144
}
145145
}
146146

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

171171

‎src/providers/wfs/qgswfsdatasourceuri.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class QgsWFSDataSourceURI
8585
explicit QgsWFSDataSourceURI( const QString &uri );
8686

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

9090
//! Returns base URL (with SERVICE=WFS parameter if bIncludeServiceWFS=true)
9191
QUrl baseURL( bool bIncludeServiceWFS = true ) const;

‎src/providers/wfs/qgswfssourceselect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ void QgsWFSSourceSelect::addButtonClicked()
404404
}
405405
QgsDebugMsg( "Layer " + typeName + " SQL is " + sql );
406406

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

410410
emit addVectorLayer( mUri, layerName );

0 commit comments

Comments
 (0)
Please sign in to comment.