Versions: All Transact versions
Users can configure users with a database using the JDBCRealm.
1. In the server.xml file, comment MemoryRealm for context path “/dcma”.
2. Add a JDBCRealm as shown below.
Using Windows Authentication
<Realm
className=”org.apache.catalina.realm.JDBCRealm”
driverName=”net.sourceforge.jtds.jdbc.Driver”
connectionURL=”jdbc:jtds:sqlserver://localhost:1433;databaseName=<<database_name>>;sendStringParametersAsUnicode=true;prepareSQL=3;domain=<<domain_name>>”
connectionName=””
connectionPassword=””
userTable=”<<table name where users exist>>”
userNameCol=”<<column name having users>>”
userCredCol=”<<column name having password>>”
userRoleTable=”<<table name having roles>>”
roleNameCol=”<<column name having roles>>” />
Using Basic Authentication
<Realm
className=”org.apache.catalina.realm.JDBCRealm”
driverName=”net.sourceforge.jtds.jdbc.Driver”
connectionURL=”jdbc:jtds:sqlserver://localhost:1433;databaseName=Test;sendStringParametersAsUnicode=true;prepareSQL=3″
connectionName=”<<username>>”
connectionPassword=”<<password>>”
userTable=”<<table name where users exist>>”
userNameCol=”<<column name having users>>”
userCredCol=”<<column name having password>>”
userRoleTable=”<<table name having roles>>”
roleNameCol=”<<column name having roles>>” />
3. Create three tables in the database for users, users_roles, roles.
- Add columns user_name and user_pass in the users table
- Add columns user_name and role_name in the user_roles table
DDL Script for Table Creation
create table users
(
user_name varchar(15) not null primary key,
user_pass varchar(15) not null
);
create table roles
(
role_name varchar(15) not null primary key
);
create table user_roles
(
user_name varchar(15) not null,
role_name varchar(15) not null,
primary key( user_name, role_name )
);
4. Restart the server.
The database will authenticate the rest service user.