Can not create new user with REST API

Description

The usergroup API is working as expected when issuing a GET request like:
curl -X GET http://admin:geoserver@localhost:8080/geoserver/rest/security/usergroup/users/

I get {{com.thoughtworks.xstream.mapper.CannotResolveClassException: userName }} when issuing a POST to the same endpoint like this:
curl -X POST http://admin:geoserver@localhost:8080/geoserver/rest/security/usergroup/users/ -H "content-type: application/json" -d "{ \"userName\": \"foo\", \"password\": \"bAr1@345\", \"enabled\": true}"

I am getting the same result (GET is working and POST is not working) when trying to issue a new user using /rest/security/usergroup/service/myUserGroup/users/

I am getting the same results when I change the POST to use xml instead of json: content-type: application/xml &
<user>
<userName>Jim</userName>
<password>password</password>
<enabled>true</enabled>
</user>

Please also see the gis.stackexchange: https://gis.stackexchange.com/questions/256891/creating-new-geoserver-user-through-rest-api

Environment

GeoServer running in a Docker

Status

Assignee

Imran Rajjad

Reporter

Ben Wyss

Triage

Fix versions

Affects versions

Components

Priority

Medium
Configure