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

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

                    QGIS export composer to PDF scale the map [closed] Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Print Composer QGIS 2.6, how to export image?QGIS 2.8.1 print composer won't export all OpenCycleMap base layer tilesSave Print/Map QGIS composer view as PNG/PDF using Python (without changing anything in visible layout)?Export QGIS Print Composer PDF with searchable text labelsQGIS Print Composer does not change from landscape to portrait orientation?How can I avoid map size and scale changes in print composer?Fuzzy PDF export in QGIS running on macSierra OSExport the legend into its 100% size using Print ComposerScale-dependent rendering in QGIS PDF output

                    PDF-ში გადმოწერა სანავიგაციო მენიუproject page