Creating new GeoServer user through rest api?How can I add new ROLES and USERS through REST in GeoServer?Using REST service with GeoServerGeoserver Rest folder not foundReload Geoserver with REST - password securityCreating new feature type with Geoserver REST API work but return error code 500Accessing secure Geoserver layer with username passwordAdd secured WMS service from Geoserver to ArcGIS 10.2 to 10.4Geoserver REST: Change/create style via PUT/POST only possible when user is assigned admin roleGeoserver: How to enable REST Authentication filter chain to allow PUT/POST callsAccess secure Geoserver WMS from ArcGIS using LDAP Domain userHow can I add new ROLES and USERS through REST in GeoServer?
Can the discrete variable be a negative number?
How easy is it to start Magic from scratch?
Crossing the line between justified force and brutality
Purchasing a ticket for someone else in another country?
How to pronounce the slash sign
Did Dumbledore lie to Harry about how long he had James Potter's invisibility cloak when he was examining it? If so, why?
How to safely derail a train during transit?
How do scammers retract money, while you can’t?
Was a professor correct to chastise me for writing "Dear Prof. X" rather than "Dear Professor X"?
Valid Badminton Score?
How can I get through very long and very dry, but also very useful technical documents when learning a new tool?
How long to clear the 'suck zone' of a turbofan after start is initiated?
How to Reset Passwords on Multiple Websites Easily?
How does buying out courses with grant money work?
Implement the Thanos sorting algorithm
How to write papers efficiently when English isn't my first language?
Large drywall patch supports
How do I extract a value from a time formatted value in excel?
Sort a list by elements of another list
How did Doctor Strange see the winning outcome in Avengers: Infinity War?
Is the destination of a commercial flight important for the pilot?
Do sorcerers' Subtle Spells require a skill check to be unseen?
How can I kill an app using Terminal?
What does 算不上 mean in 算不上太美好的日子?
Creating new GeoServer user through rest api?
How can I add new ROLES and USERS through REST in GeoServer?Using REST service with GeoServerGeoserver Rest folder not foundReload Geoserver with REST - password securityCreating new feature type with Geoserver REST API work but return error code 500Accessing secure Geoserver layer with username passwordAdd secured WMS service from Geoserver to ArcGIS 10.2 to 10.4Geoserver REST: Change/create style via PUT/POST only possible when user is assigned admin roleGeoserver: How to enable REST Authentication filter chain to allow PUT/POST callsAccess secure Geoserver WMS from ArcGIS using LDAP Domain userHow can I add new ROLES and USERS through REST in GeoServer?
I've tried posting this xml:
<user>
<userName>Jim</userName>
<password>password</password>
<enabled>true</enabled>
</user>
to these addresses:
http://localhost:8080/geoserver/rest/usergroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/usergroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/users/
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/user/Jim
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/users/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/users/user/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/user/Jim
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/user/Jim
404 - "Not Found"
I've tried with and without the GeoFence plugin.
Is this actually possible?
I have succeeded in creating roles, usergroups, workspaces, coverageStores and raster layers from GeoTiff files, and dataStores and vector layers from shapefiles, but no progress on creating users.
I gather that some modules require you to change the admin password from the default, so I've done that too. My admin account has ADMIN, GROUP_ADMIN, and ROLE_ADMIN roles, and I've even added a USER_ADMIN role in the case such a thing exists.
I'm running geoserver-2.12-SNAPSHOT from 18 September.
geoserver geoserver-rest-api geoserver-geofence
add a comment |
I've tried posting this xml:
<user>
<userName>Jim</userName>
<password>password</password>
<enabled>true</enabled>
</user>
to these addresses:
http://localhost:8080/geoserver/rest/usergroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/usergroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/users/
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/user/Jim
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/users/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/users/user/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/user/Jim
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/user/Jim
404 - "Not Found"
I've tried with and without the GeoFence plugin.
Is this actually possible?
I have succeeded in creating roles, usergroups, workspaces, coverageStores and raster layers from GeoTiff files, and dataStores and vector layers from shapefiles, but no progress on creating users.
I gather that some modules require you to change the admin password from the default, so I've done that too. My admin account has ADMIN, GROUP_ADMIN, and ROLE_ADMIN roles, and I've even added a USER_ADMIN role in the case such a thing exists.
I'm running geoserver-2.12-SNAPSHOT from 18 September.
geoserver geoserver-rest-api geoserver-geofence
add a comment |
I've tried posting this xml:
<user>
<userName>Jim</userName>
<password>password</password>
<enabled>true</enabled>
</user>
to these addresses:
http://localhost:8080/geoserver/rest/usergroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/usergroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/users/
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/user/Jim
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/users/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/users/user/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/user/Jim
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/user/Jim
404 - "Not Found"
I've tried with and without the GeoFence plugin.
Is this actually possible?
I have succeeded in creating roles, usergroups, workspaces, coverageStores and raster layers from GeoTiff files, and dataStores and vector layers from shapefiles, but no progress on creating users.
I gather that some modules require you to change the admin password from the default, so I've done that too. My admin account has ADMIN, GROUP_ADMIN, and ROLE_ADMIN roles, and I've even added a USER_ADMIN role in the case such a thing exists.
I'm running geoserver-2.12-SNAPSHOT from 18 September.
geoserver geoserver-rest-api geoserver-geofence
I've tried posting this xml:
<user>
<userName>Jim</userName>
<password>password</password>
<enabled>true</enabled>
</user>
to these addresses:
http://localhost:8080/geoserver/rest/usergroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/usergroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/users/
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/user/Jim
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/users/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/users/user/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/user
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/user/Jim
500 - "Server Error"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/Jim
404 - "Not Found"
http://localhost:8080/geoserver/rest/security/usergroup/service/MyGroup/users/user/Jim
404 - "Not Found"
I've tried with and without the GeoFence plugin.
Is this actually possible?
I have succeeded in creating roles, usergroups, workspaces, coverageStores and raster layers from GeoTiff files, and dataStores and vector layers from shapefiles, but no progress on creating users.
I gather that some modules require you to change the admin password from the default, so I've done that too. My admin account has ADMIN, GROUP_ADMIN, and ROLE_ADMIN roles, and I've even added a USER_ADMIN role in the case such a thing exists.
I'm running geoserver-2.12-SNAPSHOT from 18 September.
geoserver geoserver-rest-api geoserver-geofence
geoserver geoserver-rest-api geoserver-geofence
edited Sep 8 '18 at 7:45
Damini Jain
1,566217
1,566217
asked Sep 28 '17 at 9:51
Joe HotchkissJoe Hotchkiss
212
212
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You are very close. The documentation shows that you need to POST to
http://localhost:8080/geoserver/rest/usergroup/service/users/
As long as you are executing the POST as a user with the role ROLE_ADMIN it should work as expected.
1
http://localhost:8080/geoserver/rest/usergroup/service/users/ 404 - "Not Found" http://localhost:8080/geoserver/rest/security/usergroup/service/users/ 404 - "Not Found"
I'm afraid the documentation has shown lots of examples that are incorrect. Sorry - I can't get sensible formatting in this comment.
– Joe Hotchkiss
Sep 28 '17 at 12:57
1
The documentation shows the url as/rest/usergroup/[service/<serviceName>/]users/
so if I include the "service" element in the path then that needs to be followed by a service name e.g. "default" or "MyGroup". I should be able to list users at this url but actually I need to include the "security" element in the path to get it to work.
– Joe Hotchkiss
Sep 28 '17 at 13:05
please submit a PR for the docs if you find an issue
– Ian Turton♦
Sep 29 '17 at 10:27
1
Any news on this? I'm experiencing the same issue with the 2.12.0 version of GeoServer. The docs seems to be wrong, one has to add the /security/ to the url to access the usergroup rest api as mentioned above. The POST to the same url does not work, I get a 500 error. Besides the docs says that I should be able to perform all requests with content-type and accept header application/json but this gives a 406 Not acceptable error.
– antonLundkvist
Oct 18 '17 at 20:40
2
I am getting similar results, bot xml and json posts are reporting 500 errors for me on GeoServer 2.12.1. Checking the logs I get: Testing /rest/security/usergroup/users/ for monitor filtering ERROR [geoserver.rest] - user com.thoughtworks.xstream.mapper.CannotResolveClassException
– Bwyss
Dec 12 '17 at 0:31
|
show 2 more comments
I have found temporary solution for this.
The reason of this is that the XStream cannot map XML/JSON to org.geoserver.rest.security.xml.JaxbUser because there is no alias "user" for this.
There are two solutions for it.
- Use full class name with package in your XML/JSON.
Something like this:
"org.geoserver.rest.security.xml.JaxbUser":
"userName": "test",
"password": "test",
"enabled": true
If you use XML there is propably the same way.
- Edit org.geoserver.rest.security.UsersRestController class.
Add super class org.geoserver.rest.RestBaseController to it and override two methods
@Override
public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
return JaxbUser.class.isAssignableFrom(methodParameter.getParameterType());
@Override
public void configurePersister(XStreamPersister persister, XStreamMessageConverter converter)
persister.setHideFeatureTypeAttributes();
persister.getXStream().alias("user", JaxbUser.class);
After one of those solutions you need to add JaxbUser.class to XStream whitelist. The simplest way to do it is adding system/environment/context variable GEOSERVER_XSTREAM_WHITELIST like GEOSERVER_DATA_DIR.
E.g -DGEOSERVER_XSTREAM_WHITELIST=org.geoserver.rest.security.xml.JaxbUser
I hope this will be fixed in next versions of Geoserver. By the way the GeoServer Documentation is full of lack and need to be polished.
I have posted the same on Jira.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f256891%2fcreating-new-geoserver-user-through-rest-api%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are very close. The documentation shows that you need to POST to
http://localhost:8080/geoserver/rest/usergroup/service/users/
As long as you are executing the POST as a user with the role ROLE_ADMIN it should work as expected.
1
http://localhost:8080/geoserver/rest/usergroup/service/users/ 404 - "Not Found" http://localhost:8080/geoserver/rest/security/usergroup/service/users/ 404 - "Not Found"
I'm afraid the documentation has shown lots of examples that are incorrect. Sorry - I can't get sensible formatting in this comment.
– Joe Hotchkiss
Sep 28 '17 at 12:57
1
The documentation shows the url as/rest/usergroup/[service/<serviceName>/]users/
so if I include the "service" element in the path then that needs to be followed by a service name e.g. "default" or "MyGroup". I should be able to list users at this url but actually I need to include the "security" element in the path to get it to work.
– Joe Hotchkiss
Sep 28 '17 at 13:05
please submit a PR for the docs if you find an issue
– Ian Turton♦
Sep 29 '17 at 10:27
1
Any news on this? I'm experiencing the same issue with the 2.12.0 version of GeoServer. The docs seems to be wrong, one has to add the /security/ to the url to access the usergroup rest api as mentioned above. The POST to the same url does not work, I get a 500 error. Besides the docs says that I should be able to perform all requests with content-type and accept header application/json but this gives a 406 Not acceptable error.
– antonLundkvist
Oct 18 '17 at 20:40
2
I am getting similar results, bot xml and json posts are reporting 500 errors for me on GeoServer 2.12.1. Checking the logs I get: Testing /rest/security/usergroup/users/ for monitor filtering ERROR [geoserver.rest] - user com.thoughtworks.xstream.mapper.CannotResolveClassException
– Bwyss
Dec 12 '17 at 0:31
|
show 2 more comments
You are very close. The documentation shows that you need to POST to
http://localhost:8080/geoserver/rest/usergroup/service/users/
As long as you are executing the POST as a user with the role ROLE_ADMIN it should work as expected.
1
http://localhost:8080/geoserver/rest/usergroup/service/users/ 404 - "Not Found" http://localhost:8080/geoserver/rest/security/usergroup/service/users/ 404 - "Not Found"
I'm afraid the documentation has shown lots of examples that are incorrect. Sorry - I can't get sensible formatting in this comment.
– Joe Hotchkiss
Sep 28 '17 at 12:57
1
The documentation shows the url as/rest/usergroup/[service/<serviceName>/]users/
so if I include the "service" element in the path then that needs to be followed by a service name e.g. "default" or "MyGroup". I should be able to list users at this url but actually I need to include the "security" element in the path to get it to work.
– Joe Hotchkiss
Sep 28 '17 at 13:05
please submit a PR for the docs if you find an issue
– Ian Turton♦
Sep 29 '17 at 10:27
1
Any news on this? I'm experiencing the same issue with the 2.12.0 version of GeoServer. The docs seems to be wrong, one has to add the /security/ to the url to access the usergroup rest api as mentioned above. The POST to the same url does not work, I get a 500 error. Besides the docs says that I should be able to perform all requests with content-type and accept header application/json but this gives a 406 Not acceptable error.
– antonLundkvist
Oct 18 '17 at 20:40
2
I am getting similar results, bot xml and json posts are reporting 500 errors for me on GeoServer 2.12.1. Checking the logs I get: Testing /rest/security/usergroup/users/ for monitor filtering ERROR [geoserver.rest] - user com.thoughtworks.xstream.mapper.CannotResolveClassException
– Bwyss
Dec 12 '17 at 0:31
|
show 2 more comments
You are very close. The documentation shows that you need to POST to
http://localhost:8080/geoserver/rest/usergroup/service/users/
As long as you are executing the POST as a user with the role ROLE_ADMIN it should work as expected.
You are very close. The documentation shows that you need to POST to
http://localhost:8080/geoserver/rest/usergroup/service/users/
As long as you are executing the POST as a user with the role ROLE_ADMIN it should work as expected.
answered Sep 28 '17 at 12:29
katahdinkatahdin
2,24111624
2,24111624
1
http://localhost:8080/geoserver/rest/usergroup/service/users/ 404 - "Not Found" http://localhost:8080/geoserver/rest/security/usergroup/service/users/ 404 - "Not Found"
I'm afraid the documentation has shown lots of examples that are incorrect. Sorry - I can't get sensible formatting in this comment.
– Joe Hotchkiss
Sep 28 '17 at 12:57
1
The documentation shows the url as/rest/usergroup/[service/<serviceName>/]users/
so if I include the "service" element in the path then that needs to be followed by a service name e.g. "default" or "MyGroup". I should be able to list users at this url but actually I need to include the "security" element in the path to get it to work.
– Joe Hotchkiss
Sep 28 '17 at 13:05
please submit a PR for the docs if you find an issue
– Ian Turton♦
Sep 29 '17 at 10:27
1
Any news on this? I'm experiencing the same issue with the 2.12.0 version of GeoServer. The docs seems to be wrong, one has to add the /security/ to the url to access the usergroup rest api as mentioned above. The POST to the same url does not work, I get a 500 error. Besides the docs says that I should be able to perform all requests with content-type and accept header application/json but this gives a 406 Not acceptable error.
– antonLundkvist
Oct 18 '17 at 20:40
2
I am getting similar results, bot xml and json posts are reporting 500 errors for me on GeoServer 2.12.1. Checking the logs I get: Testing /rest/security/usergroup/users/ for monitor filtering ERROR [geoserver.rest] - user com.thoughtworks.xstream.mapper.CannotResolveClassException
– Bwyss
Dec 12 '17 at 0:31
|
show 2 more comments
1
http://localhost:8080/geoserver/rest/usergroup/service/users/ 404 - "Not Found" http://localhost:8080/geoserver/rest/security/usergroup/service/users/ 404 - "Not Found"
I'm afraid the documentation has shown lots of examples that are incorrect. Sorry - I can't get sensible formatting in this comment.
– Joe Hotchkiss
Sep 28 '17 at 12:57
1
The documentation shows the url as/rest/usergroup/[service/<serviceName>/]users/
so if I include the "service" element in the path then that needs to be followed by a service name e.g. "default" or "MyGroup". I should be able to list users at this url but actually I need to include the "security" element in the path to get it to work.
– Joe Hotchkiss
Sep 28 '17 at 13:05
please submit a PR for the docs if you find an issue
– Ian Turton♦
Sep 29 '17 at 10:27
1
Any news on this? I'm experiencing the same issue with the 2.12.0 version of GeoServer. The docs seems to be wrong, one has to add the /security/ to the url to access the usergroup rest api as mentioned above. The POST to the same url does not work, I get a 500 error. Besides the docs says that I should be able to perform all requests with content-type and accept header application/json but this gives a 406 Not acceptable error.
– antonLundkvist
Oct 18 '17 at 20:40
2
I am getting similar results, bot xml and json posts are reporting 500 errors for me on GeoServer 2.12.1. Checking the logs I get: Testing /rest/security/usergroup/users/ for monitor filtering ERROR [geoserver.rest] - user com.thoughtworks.xstream.mapper.CannotResolveClassException
– Bwyss
Dec 12 '17 at 0:31
1
1
http://localhost:8080/geoserver/rest/usergroup/service/users/ 404 - "Not Found" http://localhost:8080/geoserver/rest/security/usergroup/service/users/ 404 - "Not Found"
I'm afraid the documentation has shown lots of examples that are incorrect. Sorry - I can't get sensible formatting in this comment.– Joe Hotchkiss
Sep 28 '17 at 12:57
http://localhost:8080/geoserver/rest/usergroup/service/users/ 404 - "Not Found" http://localhost:8080/geoserver/rest/security/usergroup/service/users/ 404 - "Not Found"
I'm afraid the documentation has shown lots of examples that are incorrect. Sorry - I can't get sensible formatting in this comment.– Joe Hotchkiss
Sep 28 '17 at 12:57
1
1
The documentation shows the url as
/rest/usergroup/[service/<serviceName>/]users/
so if I include the "service" element in the path then that needs to be followed by a service name e.g. "default" or "MyGroup". I should be able to list users at this url but actually I need to include the "security" element in the path to get it to work.– Joe Hotchkiss
Sep 28 '17 at 13:05
The documentation shows the url as
/rest/usergroup/[service/<serviceName>/]users/
so if I include the "service" element in the path then that needs to be followed by a service name e.g. "default" or "MyGroup". I should be able to list users at this url but actually I need to include the "security" element in the path to get it to work.– Joe Hotchkiss
Sep 28 '17 at 13:05
please submit a PR for the docs if you find an issue
– Ian Turton♦
Sep 29 '17 at 10:27
please submit a PR for the docs if you find an issue
– Ian Turton♦
Sep 29 '17 at 10:27
1
1
Any news on this? I'm experiencing the same issue with the 2.12.0 version of GeoServer. The docs seems to be wrong, one has to add the /security/ to the url to access the usergroup rest api as mentioned above. The POST to the same url does not work, I get a 500 error. Besides the docs says that I should be able to perform all requests with content-type and accept header application/json but this gives a 406 Not acceptable error.
– antonLundkvist
Oct 18 '17 at 20:40
Any news on this? I'm experiencing the same issue with the 2.12.0 version of GeoServer. The docs seems to be wrong, one has to add the /security/ to the url to access the usergroup rest api as mentioned above. The POST to the same url does not work, I get a 500 error. Besides the docs says that I should be able to perform all requests with content-type and accept header application/json but this gives a 406 Not acceptable error.
– antonLundkvist
Oct 18 '17 at 20:40
2
2
I am getting similar results, bot xml and json posts are reporting 500 errors for me on GeoServer 2.12.1. Checking the logs I get: Testing /rest/security/usergroup/users/ for monitor filtering ERROR [geoserver.rest] - user com.thoughtworks.xstream.mapper.CannotResolveClassException
– Bwyss
Dec 12 '17 at 0:31
I am getting similar results, bot xml and json posts are reporting 500 errors for me on GeoServer 2.12.1. Checking the logs I get: Testing /rest/security/usergroup/users/ for monitor filtering ERROR [geoserver.rest] - user com.thoughtworks.xstream.mapper.CannotResolveClassException
– Bwyss
Dec 12 '17 at 0:31
|
show 2 more comments
I have found temporary solution for this.
The reason of this is that the XStream cannot map XML/JSON to org.geoserver.rest.security.xml.JaxbUser because there is no alias "user" for this.
There are two solutions for it.
- Use full class name with package in your XML/JSON.
Something like this:
"org.geoserver.rest.security.xml.JaxbUser":
"userName": "test",
"password": "test",
"enabled": true
If you use XML there is propably the same way.
- Edit org.geoserver.rest.security.UsersRestController class.
Add super class org.geoserver.rest.RestBaseController to it and override two methods
@Override
public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
return JaxbUser.class.isAssignableFrom(methodParameter.getParameterType());
@Override
public void configurePersister(XStreamPersister persister, XStreamMessageConverter converter)
persister.setHideFeatureTypeAttributes();
persister.getXStream().alias("user", JaxbUser.class);
After one of those solutions you need to add JaxbUser.class to XStream whitelist. The simplest way to do it is adding system/environment/context variable GEOSERVER_XSTREAM_WHITELIST like GEOSERVER_DATA_DIR.
E.g -DGEOSERVER_XSTREAM_WHITELIST=org.geoserver.rest.security.xml.JaxbUser
I hope this will be fixed in next versions of Geoserver. By the way the GeoServer Documentation is full of lack and need to be polished.
I have posted the same on Jira.
add a comment |
I have found temporary solution for this.
The reason of this is that the XStream cannot map XML/JSON to org.geoserver.rest.security.xml.JaxbUser because there is no alias "user" for this.
There are two solutions for it.
- Use full class name with package in your XML/JSON.
Something like this:
"org.geoserver.rest.security.xml.JaxbUser":
"userName": "test",
"password": "test",
"enabled": true
If you use XML there is propably the same way.
- Edit org.geoserver.rest.security.UsersRestController class.
Add super class org.geoserver.rest.RestBaseController to it and override two methods
@Override
public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
return JaxbUser.class.isAssignableFrom(methodParameter.getParameterType());
@Override
public void configurePersister(XStreamPersister persister, XStreamMessageConverter converter)
persister.setHideFeatureTypeAttributes();
persister.getXStream().alias("user", JaxbUser.class);
After one of those solutions you need to add JaxbUser.class to XStream whitelist. The simplest way to do it is adding system/environment/context variable GEOSERVER_XSTREAM_WHITELIST like GEOSERVER_DATA_DIR.
E.g -DGEOSERVER_XSTREAM_WHITELIST=org.geoserver.rest.security.xml.JaxbUser
I hope this will be fixed in next versions of Geoserver. By the way the GeoServer Documentation is full of lack and need to be polished.
I have posted the same on Jira.
add a comment |
I have found temporary solution for this.
The reason of this is that the XStream cannot map XML/JSON to org.geoserver.rest.security.xml.JaxbUser because there is no alias "user" for this.
There are two solutions for it.
- Use full class name with package in your XML/JSON.
Something like this:
"org.geoserver.rest.security.xml.JaxbUser":
"userName": "test",
"password": "test",
"enabled": true
If you use XML there is propably the same way.
- Edit org.geoserver.rest.security.UsersRestController class.
Add super class org.geoserver.rest.RestBaseController to it and override two methods
@Override
public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
return JaxbUser.class.isAssignableFrom(methodParameter.getParameterType());
@Override
public void configurePersister(XStreamPersister persister, XStreamMessageConverter converter)
persister.setHideFeatureTypeAttributes();
persister.getXStream().alias("user", JaxbUser.class);
After one of those solutions you need to add JaxbUser.class to XStream whitelist. The simplest way to do it is adding system/environment/context variable GEOSERVER_XSTREAM_WHITELIST like GEOSERVER_DATA_DIR.
E.g -DGEOSERVER_XSTREAM_WHITELIST=org.geoserver.rest.security.xml.JaxbUser
I hope this will be fixed in next versions of Geoserver. By the way the GeoServer Documentation is full of lack and need to be polished.
I have posted the same on Jira.
I have found temporary solution for this.
The reason of this is that the XStream cannot map XML/JSON to org.geoserver.rest.security.xml.JaxbUser because there is no alias "user" for this.
There are two solutions for it.
- Use full class name with package in your XML/JSON.
Something like this:
"org.geoserver.rest.security.xml.JaxbUser":
"userName": "test",
"password": "test",
"enabled": true
If you use XML there is propably the same way.
- Edit org.geoserver.rest.security.UsersRestController class.
Add super class org.geoserver.rest.RestBaseController to it and override two methods
@Override
public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
return JaxbUser.class.isAssignableFrom(methodParameter.getParameterType());
@Override
public void configurePersister(XStreamPersister persister, XStreamMessageConverter converter)
persister.setHideFeatureTypeAttributes();
persister.getXStream().alias("user", JaxbUser.class);
After one of those solutions you need to add JaxbUser.class to XStream whitelist. The simplest way to do it is adding system/environment/context variable GEOSERVER_XSTREAM_WHITELIST like GEOSERVER_DATA_DIR.
E.g -DGEOSERVER_XSTREAM_WHITELIST=org.geoserver.rest.security.xml.JaxbUser
I hope this will be fixed in next versions of Geoserver. By the way the GeoServer Documentation is full of lack and need to be polished.
I have posted the same on Jira.
edited 17 hours ago
Peter
313110
313110
answered Mar 23 '18 at 13:00
implssvimplssv
234
234
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f256891%2fcreating-new-geoserver-user-through-rest-api%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown