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?













4















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.










share|improve this question




























    4















    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.










    share|improve this question


























      4












      4








      4








      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.










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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




















          2 Answers
          2






          active

          oldest

          votes


















          1














          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.






          share|improve this answer


















          • 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














          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.



          1. 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.



          1. 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.






          share|improve this answer
























            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
            );



            );













            draft saved

            draft discarded


















            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









            1














            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.






            share|improve this answer


















            • 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














            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.






            share|improve this answer


















            • 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








            1







            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.






            share|improve this answer













            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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












            • 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













            1














            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.



            1. 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.



            1. 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.






            share|improve this answer





























              1














              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.



              1. 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.



              1. 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.






              share|improve this answer



























                1












                1








                1







                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.



                1. 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.



                1. 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.






                share|improve this answer















                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.



                1. 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.



                1. 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.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 17 hours ago









                Peter

                313110




                313110










                answered Mar 23 '18 at 13:00









                implssvimplssv

                234




                234



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

                    Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

                    Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221