安全性

RESTAPI允许您调整地理服务器安全设置。

备注

阅读 API reference for /security .

列出密钥库密码

检索“root”帐户的密钥库密码

请求

卷曲

curl -v -u admin:geoserver -XGET http://localhost:8080/geoserver/rest/security/masterpw.xml

更改密钥库密码

更改为新的密钥库密码

备注

需要知道当前密钥库密码。

给出了一个 changes.xml 文件:

<masterPassword>
   <oldMasterPassword>-"}3a^Kh</oldMasterPassword>
   <newMasterPassword>geoserver1</newMasterPassword>
</masterPassword>

请求

卷曲

curl -v -u admin:geoserver -XPUT -H "Content-type: text/xml" -d @change.xml http://localhost:8080/geoserver/rest/security/masterpw.xml

响应

200 OK

列出目录模式

获取当前目录模式

请求

卷曲

curl -v -u admin:geoserver -XGET   http://localhost:8080/geoserver/rest/security/acl/catalog.xml

响应

<?xml version="1.0" encoding="UTF-8"?>
<catalog>
    <mode>HIDE</mode>
</catalog>

更改目录模式

设置新目录模式

给出了一个 newMode.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<catalog>
    <mode>MIXED</mode>
</catalog>

请求

卷曲

curl -v -u admin:geoserver -XPUT -H "Content-type: text/xml" -d @newMode.xml http://localhost:8080/geoserver/rest/security/acl/catalog.xml

列出访问控制规则

检索访问控制规则的当前列表

请求

卷曲

curl -v -u admin:geoserver -XGET http://localhost:8080/geoserver/rest/security/acl/layers.xml

响应

<?xml version="1.0" encoding="UTF-8"?>
<rules />

备注

上述响应未显示指定的规则。

更改访问控制规则

设置新的访问控制规则列表

给出了一个 rules.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<rules>
   <rule resource="topp.*.r">ROLE_AUTHORIZED</rule>
   <rule resource="topp.mylayer.w">ROLE_1,ROLE_2</rule>
</rules>

请求

卷曲

curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d @rules.xml http://localhost:8080/geoserver/rest/security/acl/layers.xml

响应

201 Created

删除访问控制规则

删除个人访问控制规则

请求

卷曲

curl -v -u admin:geoserver -XDELETE  http://localhost:8080/geoserver/rest/security/acl/layers/topp.*.r

响应

200 OK
Previous:
Next: 风格