新闻资讯
看你所看,想你所想

security-constraint元素

security-constraint元素

部署描述符中的security-constraint元素允许不通过编程就可以限制对某个资源的访问。
<!ELEMENT security-constraint (display-name?,
web-resource-collection+,
auth-constraint?, user-data-constraint?)>
<!ELEMENT display-name (#PCDATA)>
<!ELEMENT web-resource-collection (web-resource-name, description?,
url-pattern*, http-method*)>
<!ELEMENT auth-constraint (description?, role-name*)>
<!ELEMENT user-data-constraint (description?, transport-guarantee)>
(1) web-resource-collection元素
web-resource-collection元素标识需要限制访问的资源子集。在web-resource-collection元素中,可以定义URL模式和HTTP方法。如果不存在HTTP方法,就将安全约束套用于所有的方法。
url-pattern*, http-method*)>
<!ELEMENT web-resource-name (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT url-pattern (#PCDATA)>
<!ELEMENT http-method (#PCDATA)>
web-resource-name是与受保护资源相关联的名称。http-method元素可被赋予一个HTTP方法,比如GET和POST。
(2) auth-constraint元素
auth-constraint元素用于指定可以访问该资源集合的用户角色。如果没有指定auth-constraint元素,就将安全约束套用于所有角色。
<!ELEMENT auth-constraint (description?, role-name*)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT role-name (#PCDATA)>
role-name元素包含安全形色的名称。
(3) user-data-constraint元素
user-data-constraint元素用来显示怎样保护在客户端和Web容器之间传递的数据。
<!ELEMENT description (#PCDATA)>
<!ELEMENT transport-guarantee (#PCDATA)>
transport-guarantee元素必须具有如下的某个值:
● NONE,这意味着套用不需要传输保证。
● INTEGRAL,意味着伺服器和客户端之间的数据必须以某种方式传送,而且在传送中不能改变。
● CONFIDENTIAL,这意味着传输的数据必须是加密的数据。
在大多数情况下,安全套接字层(SSL)用于INTEGRAL或CONFIDENTIAL。

相关推荐

声明:此文信息来源于网络,登载此文只为提供信息参考,并不用于任何商业目的。如有侵权,请及时联系我们:yongganaa@126.com