security.rst 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. .. _rest_security:
  2. Security
  3. ========
  4. The REST API allows you to adjust GeoServer security settings.
  5. .. note:: Read the :api:`API reference for /security <security.yaml>`.
  6. Listing the keystore password
  7. -----------------------------
  8. **Retrieve the keystore password for the "root" account**
  9. *Request*
  10. .. admonition:: curl
  11. ::
  12. curl -v -u admin:geoserver -XGET http://localhost:8080/geoserver/rest/security/masterpw.xml
  13. Changing the keystore password
  14. ------------------------------
  15. **Change to a new keystore password**
  16. .. note:: Requires knowledge of the current keystore password.
  17. Given a ``changes.xml`` file:
  18. .. code-block:: xml
  19. <masterPassword>
  20. <oldMasterPassword>-"}3a^Kh</oldMasterPassword>
  21. <newMasterPassword>geoserver1</newMasterPassword>
  22. </masterPassword>
  23. *Request*
  24. .. admonition:: curl
  25. ::
  26. curl -v -u admin:geoserver -XPUT -H "Content-type: text/xml" -d @change.xml http://localhost:8080/geoserver/rest/security/masterpw.xml
  27. *Response*
  28. ::
  29. 200 OK
  30. Listing the catalog mode
  31. ------------------------
  32. **Fetch the current catalog mode**
  33. *Request*
  34. .. admonition:: curl
  35. ::
  36. curl -v -u admin:geoserver -XGET http://localhost:8080/geoserver/rest/security/acl/catalog.xml
  37. *Response*
  38. .. code-block:: xml
  39. <?xml version="1.0" encoding="UTF-8"?>
  40. <catalog>
  41. <mode>HIDE</mode>
  42. </catalog>
  43. Changing the catalog mode
  44. -------------------------
  45. **Set a new catalog mode**
  46. Given a ``newMode.xml`` file:
  47. .. code-block:: xml
  48. <?xml version="1.0" encoding="UTF-8"?>
  49. <catalog>
  50. <mode>MIXED</mode>
  51. </catalog>
  52. *Request*
  53. .. admonition:: curl
  54. ::
  55. curl -v -u admin:geoserver -XPUT -H "Content-type: text/xml" -d @newMode.xml http://localhost:8080/geoserver/rest/security/acl/catalog.xml
  56. Listing access control rules
  57. ----------------------------
  58. **Retrieve current list of access control rules**
  59. *Request*
  60. .. admonition:: curl
  61. ::
  62. curl -v -u admin:geoserver -XGET http://localhost:8080/geoserver/rest/security/acl/layers.xml
  63. *Response*
  64. .. code-block:: xml
  65. <?xml version="1.0" encoding="UTF-8"?>
  66. <rules />
  67. .. note:: The above response shows no rules specified.
  68. Changing access control rules
  69. -----------------------------
  70. **Set a new list of access control rules**
  71. Given a ``rules.xml`` file:
  72. .. code-block:: xml
  73. <?xml version="1.0" encoding="UTF-8"?>
  74. <rules>
  75. <rule resource="topp.*.r">ROLE_AUTHORIZED</rule>
  76. <rule resource="topp.mylayer.w">ROLE_1,ROLE_2</rule>
  77. </rules>
  78. *Request*
  79. .. admonition:: curl
  80. ::
  81. curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d @rules.xml http://localhost:8080/geoserver/rest/security/acl/layers.xml
  82. *Response*
  83. ::
  84. 201 Created
  85. Deleting access control rules
  86. -----------------------------
  87. **Delete individual access control rule**
  88. *Request*
  89. .. admonition:: curl
  90. ::
  91. curl -v -u admin:geoserver -XDELETE http://localhost:8080/geoserver/rest/security/acl/layers/topp.*.r
  92. *Response*
  93. ::
  94. 200 OK