• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

question about user roles

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The security role of the user can be accessed with


I know roles are usually set while configuring the web app container (for example in Tomcat's /conf/tomcat-users.xml), but is there a way to also set it programatically?
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends what type of security you are using. Since we're talking about Tomcat, it supports several Realms such as memory, JDBC and LDAP. If you store the user authentication and authorisation information in (for instance) a database and use the JDBC Realm, you can then alter authorisation roles programatically. I don't believe the tomcat-users.xml can be edited at runtime.

Dave
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks David.

Yes, I am using JDBC resources for my database management. There is no problem with the programatic authentication. I just would like to know how to set user roles without having to modify conf files
[ July 02, 2006: Message edited by: kwame Iwegbue ]
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If you store the user authentication and authorisation information in (for instance) a database and use the JDBC Realm, you can then alter authorisation roles programatically.



Using JDBC realm, how would i test for a user's role using code in a servlet such as


I know you can get this information if roles have been defined in web.xml, but this approach is server specific, which is why i am trying to do it programatically.

someone please help!!!
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the Security Filter project as an alternative approach.
 
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic