<div dir="ltr"><span style="font-family:Arial">Dear Laurentiu,</span><div>I don't use command line tools. I use GDAL API. I only used them here to show the problem.</div><div>For similar reasons I wouldn't even like to use global configuration options :-)</div><div>In my opinion, the most clean way to do it is to hide credentials in dataset instance.</div><div><br></div><div>Michał</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">wt., 29 paź 2024 o 15:18 Laurențiu Nicola via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>> napisał(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg7776698126010192373"><u></u><div><div style="font-family:Arial">Hi,<br></div><div style="font-family:Arial"><br></div><div style="font-family:Arial">It's unlikely to be a problem for you, but credential passing via command-line arguments is considered an anti-pattern because they're visible by other users who might be looking at the running process list. Environment variables are better because other users can't inspect them.<br></div><div style="font-family:Arial"><br></div><div style="font-family:Arial">Of course, this is arguably even less relevant in today's container/k8s world, and config options are awkward when you need to open multiple datasets from different sources.<br></div><div style="font-family:Arial"><br></div><div style="font-family:Arial">Laurentiu<br></div><div style="font-family:Arial"><br></div><div>On Tue, Oct 29, 2024, at 14:53, Michał Kowalczuk via gdal-dev wrote:<br></div><blockquote type="cite" id="m_7776698126010192373qt"><div dir="ltr"><div>Hi GDAL friends!<br></div><div><div><br></div><div>Why service credentials (username & password) can not be entered with open options (<b>-oo UserPwd=user:pass</b>) when working with OGC services (tested against WMS)?<br></div><div><br></div><div>I know there is a config option <b>GDAL_HTTP_USERPWD=value</b> but it's not clean solution in my opinion. Credential should be related to and owned by the dataset not the global environmental variable. What if I use more than one services that need credentials?<br></div><div><br></div><div>I know there is a "UserPwd" XML tag when using xml as an open path, but this limits the use of other open methods (<a href="https://gdal.org/en/latest/drivers/raster/wms.html#xml-description-file" target="_blank">https://gdal.org/en/latest/drivers/raster/wms.html#xml-description-file</a>).<br></div><div><br></div><div>So, the following returns dataset info<br></div><div><i>gdalinfo "WMS:sample_wms_service?request=getcapabilities&service=wms" <b>--config GDAL_HTTP_USERPWD=user:pass</b></i><br></div><div><br></div><div>and the following:<br></div><div><i>gdalinfo "WMS: sample_wms_service?request=getcapabilities&service=wms" <b>-oo UserPwd=user:pass</b></i><br></div><div>returns error:<br></div><div><i>ERROR 1: HTTP error code : 401<br>ERROR 1: Error returned by server : HTTP error code : 401 (0)<br>gdalinfo failed - unable to open</i> ...</div><div><br></div></div><div>Unfortunately, I can not share the sample service and it's credentials, but it is not needed for answer my general question.<br></div><div><br></div><div>Thank you in advance for your interest in the problem<br></div><div>Michał Kowalczuk<br></div></div><div>_______________________________________________<br></div><div>gdal-dev mailing list<br></div><div><a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br></div><div><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></div><div><br></div></blockquote><div style="font-family:Arial"><br></div></div>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></blockquote></div>