@@ -41,6 +41,22 @@ bool QgsWmsSettings::parseUri( const QString &uriString )
41
41
QgsDataSourceUri uri;
42
42
uri.setEncodedUri ( uriString );
43
43
44
+ // Setup authentication
45
+ mAuth .mUserName = uri.param ( QStringLiteral ( " username" ) );
46
+ QgsDebugMsg ( " set username to " + mAuth .mUserName );
47
+
48
+ mAuth .mPassword = uri.param ( QStringLiteral ( " password" ) );
49
+ QgsDebugMsg ( " set password to " + mAuth .mPassword );
Collapse comment Comment on line R49
Do we really want this output like this?
Well, I just moved up the existing code block, but I'm fine to remove all debug messages.
Code has comments. Press enter to view.
50
+
51
+ if ( uri.hasParam ( QStringLiteral ( " authcfg" ) ) )
52
+ {
53
+ mAuth .mAuthCfg = uri.param ( QStringLiteral ( " authcfg" ) );
54
+ }
55
+ QgsDebugMsg ( " set authcfg to " + mAuth .mAuthCfg );
56
+
57
+ mAuth .mReferer = uri.param ( QStringLiteral ( " referer" ) );
58
+ QgsDebugMsg ( " set referer to " + mAuth .mReferer );
59
+
44
60
mXyz = false ; // assume WMS / WMTS
45
61
46
62
if ( uri.param ( QStringLiteral ( " type" ) ) == QLatin1String ( " xyz" ) )
@@ -54,10 +70,6 @@ bool QgsWmsSettings::parseUri( const QString &uriString )
54
70
mMaxHeight = 0 ;
55
71
mHttpUri = uri.param ( QStringLiteral ( " url" ) );
56
72
mBaseUrl = mHttpUri ;
57
- mAuth .mUserName .clear ();
58
- mAuth .mPassword .clear ();
59
- mAuth .mReferer .clear ();
60
- mAuth .mAuthCfg .clear ();
61
73
mIgnoreGetMapUrl = false ;
62
74
mIgnoreGetFeatureInfoUrl = false ;
63
75
mSmoothPixmapTransform = true ;
@@ -87,21 +99,6 @@ bool QgsWmsSettings::parseUri( const QString &uriString )
87
99
88
100
mDpiMode = uri.hasParam ( QStringLiteral ( " dpiMode" ) ) ? static_cast < QgsWmsDpiMode >( uri.param ( QStringLiteral ( " dpiMode" ) ).toInt () ) : DpiAll;
89
101
90
- mAuth .mUserName = uri.param ( QStringLiteral ( " username" ) );
91
- QgsDebugMsg ( " set username to " + mAuth .mUserName );
92
-
93
- mAuth .mPassword = uri.param ( QStringLiteral ( " password" ) );
94
- QgsDebugMsg ( " set password to " + mAuth .mPassword );
95
-
96
- if ( uri.hasParam ( QStringLiteral ( " authcfg" ) ) )
97
- {
98
- mAuth .mAuthCfg = uri.param ( QStringLiteral ( " authcfg" ) );
99
- }
100
- QgsDebugMsg ( " set authcfg to " + mAuth .mAuthCfg );
101
-
102
- mAuth .mReferer = uri.param ( QStringLiteral ( " referer" ) );
103
- QgsDebugMsg ( " set referer to " + mAuth .mReferer );
104
-
105
102
mActiveSubLayers = uri.params ( QStringLiteral ( " layers" ) );
106
103
mActiveSubStyles = uri.params ( QStringLiteral ( " styles" ) );
107
104
QgsDebugMsg ( " Entering: layers:" + mActiveSubLayers .join ( " , " ) + " , styles:" + mActiveSubStyles .join ( " , " ) );
0 commit comments