Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

web.xml

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In web.xml where we have<auth-constraint>,<security-constraint> at el.What are the difference between these two?
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A reasonably detailed explanation of all web.xml elements can be found here (and a more detailed one in the servlet specification).

In short, auth-constraint determines which role a user must be in in order to be allowed to access a particular URL (or set of URLs), while a security-constraint (which is the parent of auth-constraint) also encompasses information about which URLs those are in particular.
 
rex tony
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ulf Dittmer:
I already saw that url,but i couldn't understand.Can you explain with examples?
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you read the relevant sections of the servlet specification as well? Tell us what you did understand from it, and what you're still unclear about. You'll learn more by explicitly writing that down than just reading what someone else has to say on the topic.

To give you a start for your own experiments, if you want to set up authentication in a web app of yours you'll need to have the following in your web.xml:
  • 1 login-config element
  • 1 or more security-role elements
  • 1 or more security-constraint elements

  •  
    rex tony
    Ranch Hand
    Posts: 159
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    DearUlf Dittmer,
    Thank you,From you i got some information.What is the purpose for tag<security-role-ref>
      Bookmark Topic Watch Topic
    • New Topic