开发者

how to enable java file in realm to all users

开发者 https://www.devze.com 2023-04-10 03:55 出处:网络
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 w

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号