users@glassfish.java.net

[gf-users] web.xml two realms for two security-constraint

From: Tomaz Majerhold <tomaz.majerhold_at_arnes.si>
Date: Tue, 06 Jan 2015 12:23:54 +0100

I have two security-constraint and I want that each is using own realm
is this possible.

something like that:

<security-constraint>
         <web-resource-collection>
             <web-resource-name>Protected Area 1</web-resource-name>
             <url-pattern>/rest/script/*</url-pattern>
             <http-method>PUT</http-method>
             <http-method>DELETE</http-method>
             <http-method>GET</http-method>
             <http-method>POST</http-method>
         </web-resource-collection>
         <auth-constraint>
             <role-name>role1</role-name>
         </auth-constraint>
     </security-constraint>

Here I want to use BASIC and File realm


<security-constraint>
         <web-resource-collection>
             <web-resource-name>Protected Area 2</web-resource-name>
             <url-pattern>/rest/users/*</url-pattern>
             <http-method>PUT</http-method>
             <http-method>DELETE</http-method>
             <http-method>GET</http-method>
             <http-method>POST</http-method>
         </web-resource-collection>
         <auth-constraint>
             <role-name>role2</role-name>
         </auth-constraint>
     </security-constraint>

And here I want to use JDBC realm


Regards, Tomaz