Skip to Content

h4.

Configuring the Database Security in WAS :-

In continuation from my earlier Blog on form based security now we are confined to use
the security scenarios at the database level.Considering a scenario where we can
implement this,below is the list of tables and configurations which is needed
to be followed for implementing authorization at the databse level.

h6. 1.Create User Table :-

This table needs the username and password columns

Create table users (username varchar(20) not null, password(20) not null)

h6. 2.Create Role Table :-

This table maintains the list of roles in application. It just needs role name column in the table.

create table roles (rolename varchar(20) not null)

h6. 3.Create User-Role Association Table:-

This table maintains association between a user and roles. A user can belong to one or more roles.

create table user_roles (username varchar(20) not null, rolename varchar(20) not null)

h6. 4.Insert data into tables :-

insert into users values(‘guru’, ‘password’)

insert into role values(‘manager’)

insert into user_roles values(‘guru’,’manager’)

h6. 5.Create User Table :-

This table needs the username and password columns.

create table users (username varchar(20) not null, password(20) not null).

h6. 6.Create Role Table :-

This table maintains the list of roles in the application. It just needs the role name column in the table.

create table roles (rolename varchar(20) not null)

h6. 7.Create User-Role Association Table:-

This table maintains association between a user and roles. A user can belong to one or more roles.

create table user_roles (username varchar(20) not null, rolename varchar(20) not null)

h6. 8.Insert data into tables:-

insert into users values(‘user1’, ‘password’)

insert into role values(‘manager’)

insert into user_roles values(‘user1’, ‘manager’)

h6. 9.Configure WAS (we use the Oracle thin driver here ) by copying this information in web.xml :-

     <

        driverName=”oracle.jdbc.driver.OracleDriver”

        connectionURL=”jdbc:oracle:thin:@{IP address}::
        connectionName=”{DB Username}”
           connectionPassword=”
        userTable=”users”
        userNameCol=”username”
        userCredCol=”password”
        userRoleTable=”user_roles”
        roleNameCol=”rolename”
/></textarea></p>

<p>        Replace the following values with environment values
           {IP Address} – IP address of database server
           – Port number

           – Service name

           {DB Username} – database login

           – password to database login

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Mattias Johansson
    Thank you for an informative blog.

    In order to keep the web application more self contained I prefer to place the jdbc-driver in WEB-INF/lib. Especially in this case where we define the security constraints in web.xml I think one should put it in WEB-INF/lib.

    If more applications make use of the driver there is of course a point in putting it in
    usr/server/lib. Do you have any more thoughts on where to put it and why?

    (0) 
    1. Guru Subramanian B Post author
      Hi,
         First up all thanks for reading the blog.
      I think if you want to personalize your jdbc-driver you can put it in usr/server/lib.Else in general cases for any web application server the driver confirguration will be in WEB-INF/lib.

      Regards,
      Guru

      (0) 

Leave a Reply