i have a web service that i want to enable for use t开发者_开发技巧o all users (web service is written as java class). I use realm to configure my website security. How can i enable this resource in web.xml?
thanks
This allows everyone (without login) to access the resource (there is no auth-constraint
tag):
<security-constraint>
<web-resource-collection>
<web-resource-name>MyWebService</web-resource-name>
<url-pattern>/public/webservice</url-pattern>
</web-resource-collection>
</security-constraint>
This allows the logged in users (which has at least one role from the security-role
list) to access the resource:
<security-constraint>
<web-resource-collection>
<web-resource-name>MyWebService</web-resource-name>
<url-pattern>/public/webservice</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>user</role-name>
<role-name>admin</role-name>
<role-name>manager</role-name>
</security-role>
精彩评论