如何保护WEB站点中的特定资源
我们公司要开始一个网站,在网站中有一些内容只有通过身份认证的用户才能下载,为了防止用户通过直接输入URL路径的方式来下载内容,我在站点设置中把这些资料定义为加密资源,并给定了相应的用户才能访问,在WEB.XML中的设置如下:
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure resources</web-resource-name>
<url-pattern>/file/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
这一段文字设置只有用户角色为“user”的人才能访问,请问当用户通过身份认证后,我怎么才能建立这个角色