Re: Question configurung JBDCRealm (Tomcat 5.5.9)

2005-12-21 Thread Mark Thomas
[EMAIL PROTECTED] wrote:
> Hi all!
> 
> I have got a question regarding setup of a JBDCRealm. I read the HOW-TO
> on Tomcat homepage, and I am wondering about the database structure.
> I have an existing application, and the database it uses has got a table
> 'users'
> with the follwing columns: login, password, roleid,... where the roleid is a
> foreign key to the table 'roles' which has columns 'id' and 'rolename'.
> It is sufficient for me because every user can only have one role. Is there
> a way to use this database structure with JDBCRealm? Or do I have to
> add more tables as described in the HOW-TO? My database structure
> already contains all information, so it would be overhead to produce an
> extra table, I think. I tried the following:
> 
>debug="99" driverName="org.postgresql.Driver"
>   connectionURL="jdbc:postgresql://localhost:5432/
>   testwebapp?user=login&password=pwd"
>   userTable="users" userNameCol="login"
>   userCredCol="password" userRoleTable="users"
>   roleNameCol="roleid" />
> 
> but I got problems on roleNameCol="roleid". How can I get the rolename
> from table roles?
> 
> Perhaps I missed something, and someone has an idea.

Does you database support views? The JDBCRealm works just as well with
views as well as tables. Just create views with the structure Tomcat
expects.

Mark


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question configurung JBDCRealm (Tomcat 5.5.9)

2005-12-21 Thread Martin Gainty
Guten Tag  Peter
Since rolNameCol is defined as "The name of the column, in the user roles 
table, that contains the name of a role assigned to this user.
so you will need 2 tables 'users' and 'user-roles'"

Then you will need to create 2 tables 'users' and 'user-roles' where user_name 
is a foreign key to role assigned within the 'user_roles' table
create table users (
  user_name varchar(15) not null primary key,
  user_pass varchar(15) not null
);

create table user_roles (
  user_name varchar(15) not null,
  role_name varchar(15) not null,
  primary key (user_name, role_name)
);

begreife?
Martin -


 ldap://localhost:389";
   userPattern="uid={0},ou=people,dc=mycompany,dc=com"
  roleBase="ou=groups,dc=mycompany,dc=com"
  roleName="cn"
roleSearch="(uniqueMember={0})"
/>
 

- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, December 21, 2005 6:03 AM
Subject: Question configurung JBDCRealm (Tomcat 5.5.9)


> Hi all!
> 
> I have got a question regarding setup of a JBDCRealm. I read the HOW-TO
> on Tomcat homepage, and I am wondering about the database structure.
> I have an existing application, and the database it uses has got a table
> 'users'
> with the follwing columns: login, password, roleid,... where the roleid is a
> foreign key to the table 'roles' which has columns 'id' and 'rolename'.
> It is sufficient for me because every user can only have one role. Is there
> a way to use this database structure with JDBCRealm? Or do I have to
> add more tables as described in the HOW-TO? My database structure
> already contains all information, so it would be overhead to produce an
> extra table, I think. I tried the following:
> 
>  debug="99" driverName="org.postgresql.Driver"
> connectionURL="jdbc:postgresql://localhost:5432/
> testwebapp?user=login&password=pwd"
> userTable="users" userNameCol="login"
> userCredCol="password" userRoleTable="users"
> roleNameCol="roleid" />
> 
> but I got problems on roleNameCol="roleid". How can I get the rolename
> from table roles?
> 
> Perhaps I missed something, and someone has an idea.
> 
> Thanks
> 
> Peter
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Re: AW: Question configurung JBDCRealm (Tomcat 5.5.9)

2005-12-21 Thread andy gordon
Peter, 
   
  Have you tried the following? I placed arrows pointing to my suggestions.
   
   
   
  debug="99" driverName="org.postgresql.Driver"
connectionURL="jdbc:postgresql://localhost:5432/
testwebapp?user=login&password=pwd"
userTable="users" userNameCol="login"
userCredCol="password" userRoleTable="roles"<---  
roleNameCol="rolename" /> <---

   
   
  hth
   
  - andy

[EMAIL PROTECTED] wrote:
  Hi andy!

As in the HOW-TO described you need two tables, one
table 'users' that holds the username and the password,
and one table that holds the username and the roles
the user is given (it is a mapping from users to roles).
My database has also two tables, but the first table holds
username, password AND roles, and the second table only is
a collection of role names, assigned with an id. So
my tables look like this:

table users

username(login) | password | roleid

peter | secret | 0
andy | terces | 1

table roles

id | rolename

0 | admin
1 | someuser

I tried several combinations of tables/columnnames in my
realm config, but none worked.

Thanks

Peter

-Ursprüngliche Nachricht-
Von: andy gordon [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 21. Dezember 2005 12:51
An: Tomcat Users List
Betreff: Re: Question configurung JBDCRealm (Tomcat 5.5.9)


Peter, 

If I understand what you described, it looks like your database is ok but
your specification to tomcat is ever so slightly off. Change your server.xml
in a way so that the role elements reference the role table and not users
table. 

HTH 

- andy

[EMAIL PROTECTED] wrote:
Hi all!

I have got a question regarding setup of a JBDCRealm. I read the HOW-TO
on Tomcat homepage, and I am wondering about the database structure.
I have an existing application, and the database it uses has got a table
'users'
with the follwing columns: login, password, roleid,... where the roleid is a
foreign key to the table 'roles' which has columns 'id' and 'rolename'.
It is sufficient for me because every user can only have one role. Is there
a way to use this database structure with JDBCRealm? Or do I have to
add more tables as described in the HOW-TO? My database structure
already contains all information, so it would be overhead to produce an
extra table, I think. I tried the following:

debug="99" driverName="org.postgresql.Driver"
connectionURL="jdbc:postgresql://localhost:5432/
testwebapp?user=login&password=pwd"
userTable="users" userNameCol="login"
userCredCol="password" userRoleTable="users"
roleNameCol="roleid" />

but I got problems on roleNameCol="roleid". How can I get the rolename
from table roles?

Perhaps I missed something, and someone has an idea.

Thanks

Peter

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

AW: Question configurung JBDCRealm (Tomcat 5.5.9)

2005-12-21 Thread Peter . Zoche
Hi andy!

As in the HOW-TO described you need two tables, one
table 'users' that holds the username and the password,
and one table that holds the username and the roles
the user is given (it is a mapping from users to roles).
My database has also two tables, but the first table holds
username, password AND roles, and the second table only is
a collection of role names, assigned with an id. So
my tables look like this:

table users

username(login) | password  | roleid

peter   | secret| 0
andy| terces| 1

table roles

id  | rolename

0   | admin
1   | someuser

I tried several combinations of tables/columnnames in my
realm config, but none worked.

Thanks

Peter

-Ursprüngliche Nachricht-
Von: andy gordon [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 21. Dezember 2005 12:51
An: Tomcat Users List
Betreff: Re: Question configurung JBDCRealm (Tomcat 5.5.9)


Peter, 
   
  If I understand what you described, it looks like your database is ok but
your specification to tomcat is ever so slightly off. Change your server.xml
in a way so that the role elements reference the role table and not users
table. 
   
  HTH 
   
  - andy

[EMAIL PROTECTED] wrote:
  Hi all!

I have got a question regarding setup of a JBDCRealm. I read the HOW-TO
on Tomcat homepage, and I am wondering about the database structure.
I have an existing application, and the database it uses has got a table
'users'
with the follwing columns: login, password, roleid,... where the roleid is a
foreign key to the table 'roles' which has columns 'id' and 'rolename'.
It is sufficient for me because every user can only have one role. Is there
a way to use this database structure with JDBCRealm? Or do I have to
add more tables as described in the HOW-TO? My database structure
already contains all information, so it would be overhead to produce an
extra table, I think. I tried the following:

debug="99" driverName="org.postgresql.Driver"
connectionURL="jdbc:postgresql://localhost:5432/
testwebapp?user=login&password=pwd"
userTable="users" userNameCol="login"
userCredCol="password" userRoleTable="users"
roleNameCol="roleid" />

but I got problems on roleNameCol="roleid". How can I get the rolename
from table roles?

Perhaps I missed something, and someone has an idea.

Thanks

Peter

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question configurung JBDCRealm (Tomcat 5.5.9)

2005-12-21 Thread andy gordon
Peter, 
   
  If I understand what you described, it looks like your database is ok but 
your specification to tomcat is ever so slightly off. Change your server.xml in 
a way so that the role elements reference the role table and not users table. 
   
  HTH 
   
  - andy

[EMAIL PROTECTED] wrote:
  Hi all!

I have got a question regarding setup of a JBDCRealm. I read the HOW-TO
on Tomcat homepage, and I am wondering about the database structure.
I have an existing application, and the database it uses has got a table
'users'
with the follwing columns: login, password, roleid,... where the roleid is a
foreign key to the table 'roles' which has columns 'id' and 'rolename'.
It is sufficient for me because every user can only have one role. Is there
a way to use this database structure with JDBCRealm? Or do I have to
add more tables as described in the HOW-TO? My database structure
already contains all information, so it would be overhead to produce an
extra table, I think. I tried the following:

debug="99" driverName="org.postgresql.Driver"
connectionURL="jdbc:postgresql://localhost:5432/
testwebapp?user=login&password=pwd"
userTable="users" userNameCol="login"
userCredCol="password" userRoleTable="users"
roleNameCol="roleid" />

but I got problems on roleNameCol="roleid". How can I get the rolename
from table roles?

Perhaps I missed something, and someone has an idea.

Thanks

Peter

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Question configurung JBDCRealm (Tomcat 5.5.9)

2005-12-21 Thread Peter . Zoche
Hi all!

I have got a question regarding setup of a JBDCRealm. I read the HOW-TO
on Tomcat homepage, and I am wondering about the database structure.
I have an existing application, and the database it uses has got a table
'users'
with the follwing columns: login, password, roleid,... where the roleid is a
foreign key to the table 'roles' which has columns 'id' and 'rolename'.
It is sufficient for me because every user can only have one role. Is there
a way to use this database structure with JDBCRealm? Or do I have to
add more tables as described in the HOW-TO? My database structure
already contains all information, so it would be overhead to produce an
extra table, I think. I tried the following:



but I got problems on roleNameCol="roleid". How can I get the rolename
from table roles?

Perhaps I missed something, and someone has an idea.

Thanks

Peter

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]