I have the same problem with leaflet and WMS. Same setup with data in
postgreSQL, basic authentication and the Catalog Mode set to Challenge
which I have read is required.
This related post suggest the authentication should be "handled
automatically" but this does not occur:
https://gis.stackexchange.com/questions/227553/geoserver-rest-authentication-form
<https://gis.stackexchange.com/questions/227553/geoserver-rest-authentication-form>
this post suggests using the fetch API although personally I was not able
to implement this:
https://gis.stackexchange.com/questions/284954/how-to-authenticate-wfs-requests-being-made-to-geoserver-through-openlayers-appl/285069
This post is also related:
https://stackoverflow.com/questions/51758817/how-to-authorize-accessing-the-geoserver-layers
And then there is also this post:
https://gis.stackexchange.com/questions/86790/authentication-in-geoserver-2-4-x-from-a-web-application/97448#97448
Despite of this I am still unable to establish the link between GeoServer
and Leaflet receiving the 401 error.  Note that if I am already logged into
GeoSever then the WMS layer works fine, therefore I am confident that
establishing JavaScript or ajax based method to authenticate the user into
GeoServer at the beginning of the session is the solution.  However I am
still unsure about how to do this.
Vera

On Sun, Apr 14, 2019, 1:36 PM Eric Plassot via Geoserver-users <
geoserver-users@lists.sourceforge.net> wrote:

> Hello
> I have a layer cite: administration that is linked to a POSTGRESQL
> database and I can not configure a wfs-t authentication. My query in
> openlayers always gives error 401 and in geoserver log 'Failed login'
> The request is
> <wfs: Transaction service = "WFS" version = "1.1.0" xmlns: wfs =
> "http://www.opengis.net/wfs"; <http://www.opengis.net/wfs> xmlns: cite =
> "http://www.opengeospatial.net/cite"; <http://www.opengeospatial.net/cite>
> xmlns: gml = "http://www.opengis.net/gml"; <http://www.opengis.net/gml>
> xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance";
> <http://www.w3.org/2001/XMLSchema-instance> xsi: schemaLocation = "http:
> //www.opengis .net / wfs
> http://schemas.opengis.net/wfs/1.1.0/WFS-transaction.xsd
> http://www.opengeospatial.net/cite http://ip_adress:8080/geoserver/wfs/
> DescribeFeatureType? Typename = cite: administration "> <wfs: Insert> <
> cite: administration> <cite: geom> <gml: MultiSurface xmlns ="
> http://www.opengis.net/gml "srsName =" EPSG: 2154 " <gml: surfaceMember>
> <gml: Polygon srsName = "EPSG: 2154"> <gml: exterior> <gml: LinearRing
> srsName = "EPSG: 2154"> <gml: posList srsDimension = "2"> 793236.2285561005
> 5401066.196149358 793193.2327276901 5400993.3421067735 793272.0584131093
> 5400974.232849702 793300.7222987162 5401037.532263751 793236.2285561005
> 5401066.196149358 </ gml: posList> </ gml: LinearRing> </ gml: exterior> </
> gml: Polygon> </ gml: surfaceMember> </ gml: MultiSurface> < / cite:
> geom> </ cite: Body> </ wfs: insert> </ wfs: Transaction>
>
>  and in openlayers I try:
> var headers = new Headers ({
>      'Authorization': 'Basic' + btoa (username + ':' + password),
>      'Content-Type': 'application / x-www-form-urlencoded'
>    })
> fetch ( 'http: // ip_adress: 8080 / geoserver / wfs', {
>         method: 'POST',
> headers: headers,
>         body: request
>       }). then (function (response) {
>         return response.text ();
>       }). then (function (text) {
>         var result = text;
> console.log ( 'result -------------------------------------------- ------
> ', result)
>  });
>
> I set up a user group
> I tried to put a data access rule for this layer - cite.administration.w -
> but
> it does not memorize. Even with reading the geoserver manual 2.15 I can
> not do it.
> Can you help me please ?
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
> this list:
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
>
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to