I can uriencode the entire url. This link shows how it could be done with 
javascript: 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI
Or you can look up what the escaped . character would be and use that.

From: Gus MacAulay <g...@thuser.com.au>
Sent: Tuesday, 5 April 2022 12:15 PM
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] Rest API username parsing issue

Hi List,

I'm trying to use the REST API to enable/disable users, but running into an 
issue when the username contains punctuation like @ or . (if the username is an 
email for example).

If I create a user 't...@test.com' and do this:

curl -H 'Content-Type: application/json' -X POST 
http://admin:geoserver@localhost:9090/geoserver/rest/security/usergroup/user/test%40test..com<http://admin:geoserver@localhost:9090/geoserver/rest/security/usergroup/user/>
 -d '{"org.geoserver.rest.security.xml.JaxbUser":{"userName": 
"t...@test.com<mailto:t...@test.com>","password": "test123","enabled": false}}'

I get this:

URI:/geoserver/rest/security/usergroup/user/test%40test..com
STATUS:404
MESSAGE:Provided username does not exist: test@test.
SERVLET:dispatcher

You can see I already did some experimenting with the url to encode/escpae the 
'@' with '%40' and the '.' with a second '.' - but I can't figure a way to make 
it recognise the whole username.  Is there a workaround or is this a bug?

Thanks
Gus


________________________________

CONFIDENTIALITY NOTICE AND DISCLAIMER
The information in this transmission may be confidential and/or protected by 
legal professional privilege, and is intended only for the person or persons to 
whom it is addressed. If you are not such a person, you are warned that any 
disclosure, copying or dissemination of the information is unauthorised. If you 
have received the transmission in error, please immediately contact this office 
by telephone, fax or email, to inform us of the error and to enable 
arrangements to be made for the destruction of the transmission, or its return 
at our cost. No liability is accepted for any unauthorised use of the 
information contained in this transmission.
_______________________________________________
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