File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes access control with realm db Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "access control with realm db" Watch "access control with realm db" New topic

access control with realm db

eve agostini
Ranch Hand

Joined: Nov 01, 2005
Posts: 43
I created a web application and i deployed it on Tomcat. I'm trying to manage the access to private areas with a realm DB accessed via a JNDI named JDBC DataSource. I can successfully access the DataSource but securyty constraints do not work correctly: i am asked a username and password but none is accepted.

That's what i did:
- i've created two tables in the DB: one with usernames and passwords and the other with usernames and roles
-i configured a a JNDI named JDBC DataSource for your database (this seems to work
-i set up a <Realm> element in $CATALINA_HOME/conf/server.xml:

<Realm className="org.apache.catalina.realm.DataSourceRealm" debug="99"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name"/>

(and restarted tomcat)

-i put security constrints in the web.xml file of my application:

<web-resource-name>Secured Web Collection</web-resource-name>
<description>una autorizzazione per il gli utenti registrati</description>

thanks to anyone that could give me some advice

I agree. Here's the link:
subject: access control with realm db
jQuery in Action, 3rd edition