File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Using ROLES defined in a database in th DD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Using ROLES defined in a database in th DD" Watch "Using ROLES defined in a database in th DD" New topic
Author

Using ROLES defined in a database in th DD

Simran Dass
Ranch Hand

Joined: Jan 09, 2010
Posts: 183
In Tomcat you can define user and roles in tomcat-users.xml as :-



In the DD we can use these roles in <security-constraint> element ---



But when we define roles in a database how do we access those roles in the DD.
Will we be able to use declarative security then. An example will be of great help.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

These two resources should help

http://josescalia.wordpress.com/2009/01/27/managing-authentication-in-tomcat-with-jdbc-realms/
http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Simran Dass
Ranch Hand

Joined: Jan 09, 2010
Posts: 183
Thanks Ankit.
Read - http://josescalia.wordpress.com/2009/01/27/managin...on-in-tomcat-with-jdbc-realms/
Will try it.


Is this how its done in real projects ( I mean using realms) where supose we are using Jboss,Websphere etc. or is there some other way.
Simran Dass
Ranch Hand

Joined: Jan 09, 2010
Posts: 183
Thought instead of asking I should search myself. Found foll. link for Jboss. It looks same .

http://docs.jboss.org/jbossweb/latest/realm-howto.html


Could you please also tell if Container Managed Security is used in most of the cases . I am really confused on this. After clearing SCWCD ( if I do ) these kind of questions might be asked in the interviews.


Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

Well it depends upon the requirements of the project. Its used in the javaranch wiki I think (while editing it). The javaranch forum doesn't use it for logging in users. I've worked on a few sites in the past and it was not used in any of them...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using ROLES defined in a database in th DD
 
Similar Threads
Problem While Enabling Authentication
Problem while using REALM Security
The DD security-role element in web.xml
Security Problem
BASIC login window doesn't show up