• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Help in Adding two security constraint in web.xml

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need help in adding multiple security constraints in web.xml.
I want to add two security constraints in web.xml. I did but while deployment it is giving error in web.xml.
I have added in following manner, sample from web.xml :

<web-app>
<servlet>
</servlet>

<security-constraint>
<display-name>abcConstraint</display-name>

<web-resource-collection>
<web-resource-name>abcCollection</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>PUT</http-method>
<http-method>HEAD</http-method>
<http-method>TRACE</http-method>
<http-method>POST</http-method>
<http-method>DELETE</http-method>
<http-method>OPTIONS</http-method>
</web-resource-collection>

<auth-constraint>
<role-name>abc</role-name>
</auth-constraint>

</security-constraint>


<security-constraint>
<display-name>Access To App</display-name>

<web-resource-collection>
<web-resource-name>App Resource</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>PUT</http-method>
<http-method>POST</http-method>
</web-resource-collection>

<auth-constraint>
<role-name>def</role-name>
</auth-constraint>

</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
<realm-name>My App</realm-name>
</login-config>

<security-role>
<role-name>abc</role-name>
</security-role>
</security-role>
<role-name>def</role-name>
<security-role>

</web-app>
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
The web.xml XML schema will tell you how to formulate a valid web.xml deployment descriptor.
A copy can be found here: http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
To try your web.xml deployment descriptor out, you can validate it against the schema prior to deployment.
Best wishes!
 
Hemant Kumar Kawadlar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Ivan : Thanks Ivan.. I will check the reference given and validate may web.xml.

@Bear : Surely, I will keep that in mind from next time onwards.
 
Enjoy the full beauty of the english language. Embedded in this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic