You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by na...@locus.apache.org on 2000/09/02 00:44:47 UTC

cvs commit: jakarta-tomcat/src/doc JDBCRealm-howto.html in-process-howto.html index.html internal.html style.css JDBCRealm.howto

nacho       00/09/01 15:44:47

  Modified:    src/doc  in-process-howto.html index.html internal.html
                        style.css
  Added:       src/doc  JDBCRealm-howto.html
  Removed:     src/doc  JDBCRealm.howto
  Log:
  Some cleans, little forgets and
  a new JDBCRealm-howto in html!!
  
  Revision  Changes    Path
  1.2       +2 -1      jakarta-tomcat/src/doc/in-process-howto.html
  
  Index: in-process-howto.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/doc/in-process-howto.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- in-process-howto.html	2000/05/03 12:48:19	1.1
  +++ in-process-howto.html	2000/09/01 22:44:45	1.2
  @@ -2,6 +2,7 @@
   
   <head>
   <title>In-Process Howto</title>
  +<link rel="stylesheet" href="style.css">
   </head>
   
   <body>
  @@ -184,7 +185,7 @@
       Service fn="jk_service" worker="jni"
       &lt;/Object&gt;
   </pre>
  -</p>
  +<p></p>
   
   <p>On IIS you will have to modify your worker mount file to mount contexts
   to the JNI worker. For example:</p>
  
  
  
  1.5       +2 -2      jakarta-tomcat/src/doc/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/doc/index.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- index.html	2000/08/25 22:13:09	1.4
  +++ index.html	2000/09/01 22:44:45	1.5
  @@ -1,7 +1,7 @@
   
   <html>
     <head>
  -    <!-- $Id: index.html,v 1.4 2000/08/25 22:13:09 alex Exp $ -->
  +    <!-- $Id: index.html,v 1.5 2000/09/01 22:44:45 nacho Exp $ -->
       <!-- Copyright 1999, Apache Software Foundation -->
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
       <link rel="stylesheet" href="style.css">
  @@ -46,7 +46,7 @@
   <li><a href="tomcat-iis-howto.html">Tomcat-IIS HOWTO</a></li>
   <li><a href="tomcat-netscape-howto.html">Tomcat-Netscape HOWTO</a></li>
   <li><a href="tomcat-security.html">Using the Java SecurityManager with Tomcat</a></li>
  -<li><a href="JDBCRealm.howto">JDBC Realm HOWTO</a></li>
  +<li><a href="JDBCRealm-howto.html">JDBC Realm HOWTO</a></li>
   <li><a href="NT-Service-howto.html">NT Service HOWTO</a></li>
   <li><a href="Tomcat-Workers-HowTo.html">Tomcat Workers HOWTO</a></li>
   <li><a href="in-process-howto.html">In-process HOWTO</a></li>
  
  
  
  1.2       +8 -6      jakarta-tomcat/src/doc/internal.html
  
  Index: internal.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/doc/internal.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- internal.html	2000/07/26 21:16:01	1.1
  +++ internal.html	2000/09/01 22:44:45	1.2
  @@ -2,12 +2,14 @@
   <HTML>
   <HEAD>
   	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
  -	<TITLE></TITLE>
  -	<META NAME="GENERATOR" CONTENT="StarOffice/5.2 (Solaris Sparc)">
  -	<META NAME="AUTHOR" CONTENT="Costin Manolache">
  -	<META NAME="CREATED" CONTENT="20000303;15595000">
  -	<META NAME="CHANGEDBY" CONTENT="Costin Manolache">
  -	<META NAME="CHANGED" CONTENT="20000726;13283800">
  +	
  +<TITLE>Internal Tomcat</TITLE>
  +	
  +	
  +	
  +	
  +	
  +<link rel="stylesheet" href="style.css">
   </HEAD>
   <BODY>
   <P>This is the first draft - I will add more details and ( I hope )
  
  
  
  1.2       +1 -1      jakarta-tomcat/src/doc/style.css
  
  Index: style.css
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/doc/style.css,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- style.css	2000/08/17 20:18:06	1.1
  +++ style.css	2000/09/01 22:44:46	1.2
  @@ -16,8 +16,8 @@
   }
   
   h3 {
  -    font-family: Arial, Helvetica, sans-serif;
       color: #0033CC
  +; font: 110% Arial, Helvetica, sans-serif
   }
   
   b {
  
  
  
  1.1                  jakarta-tomcat/src/doc/JDBCRealm-howto.html
  
  Index: JDBCRealm-howto.html
  ===================================================================
  <html>
  <link rel="stylesheet" href="style.css">
  <style type="text/css">
      td {
          background-color: #E0E0E0;
          vertical-align: text-top;
      }
      th {
          background-color: #d0d0d0;
      }
      table {
          width: 75%;
          background-color: #000000;
      }
      </style>
  <title>Working with JDBCRealm</title><body>
  <h1>Working with JDBCRealm</h1>
  <h2>What is JDBCRealm?</h2>
  <p>Is an implementation of a tomcat 3.X Realm that use a  set of configurable tables inside a RDMS to store  user's data, this tables are accessed by means of standard JDBC drivers.<br>
  The passwords can be stored  as digested ( using standard Java's MessageDigest ) or in plain form.<br>
  All the parameters, drivers, tables, and columns are user configurable. </p>
  <h2>Example Config for JDBCRealm</h2>
  This is an example of how to set up a JDBC Realm. For this example I used the MySQL JDBC driver.  
  <h3>1. Create a database. </h3>
  <blockquote>
  <p>	I made the database named "authority"</p>
  </blockquote>
  <h3>  2. Create needed tables.       </h3>
  <blockquote>
  <h4>	1. The user table. </h4>
  <blockquote>
  <p>This table needs the user's name and a password          field. In the example I use "users" for the table name,          "user_name" for the column that holds the user's name, and          "user_pass" for the user's password.      </p>
  </blockquote>
  <h4>2. The role table. </h4>
  <blockquote>
  <p>This table needs the role's set up that will be         in any deployment descriptor that is managed under the container         this Realm is in. In the example I use "roles" as the table name         and "role_name" as the role's name. NB: This table doesn't get         used at all by tomcat.      </p>
  </blockquote>
  <h4>3. The role to user table. </h4>
  <blockquote>
  <p>This table joins a set of roles to a         single user. In the example the table name is "user_roles",         the role's name is "role_name" , and the user's name is assumed         to have the same column name as in the user's table ("user_name"         in this example.  </p>
  <p>Here is the SQL I used to create the tables: 
  </p>
  </blockquote>
  </blockquote>
  <table  align="center">
  <tr>
  <td>
  <pre>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 )
  );
  
  </pre>
  </td>
  </tr>
  </table>
  <blockquote>
  <blockquote>
  <p><br>
  Here is sample output from the tables:
  <br>
  <br>
  </p>
  </blockquote>
  </blockquote>
  <table align="center">
  <tr>
  <td>
  <pre>
  mysql> select * from users;
  +-----------+-----------+
  | user_name | user_pass |
  +-----------+-----------+
  | tomcat    | tomcat    |
  | user1     | tomcat    |
  | user2     | tomcat    |
  | user3     | tomcat    |
  +-----------+-----------+
  4 rows in set (0.00 sec)
  
  mysql> 
  mysql> select * from roles;
  +------------+
  | role_name  |
  +------------+
  | tomcatRole |
  | otherRole  |
  +------------+
  2 rows in set (0.02 sec)
  
  mysql> 
  
  
  mysql> select * from user_roles;
  +------------+-----------+
  | role_name  | user_name |
  +------------+-----------+
  | tomcatRole | user1     |
  | otherRole  | user2     |
  | otherRole  | tomcat    |
  | tomcatRole | tomcat    |
  +------------+-----------+
  4 rows in set (0.00 sec)
  
  mysql> 
  </pre>
  </td>
  </tr>
  
  </table>
  <h3>3. Configure Tomcat </h3>
  <blockquote>
  <p>Add the information to the server.xml file. For this example I used    this entry inside: </p>
  </blockquote>
  <table width="100%" border="0" align="center">
  <tr>
  <td>
  <blockquote>
  <p><code><br>
  &lt;RequestInterceptor 
  	className="org.apache.tomcat.realm.JDBCRealm"<br>
   
  	debug="99"      
  	driverName="org.gjt.mm.mysql.Driver" <br>
       
  	connectionURL="jdbc:mysql://localhost/authority?user=test;password=test"      
  	userTable="users"<br>
   
  	userNameCol="user_name"<br>
   
  	userCredCol="user_pass"<br>
        
  	userRoleTable="user_roles" 
  	roleNameCol="role_name" /&gt;
  <br>
  </code></p>
  </blockquote>
  </td>
  </tr>
  </table>
  <p>The meaning of the attributes is as follow:</p>
  <table align="center" width="51%">
  <tr>
  <th height="32">
  <p>attribute</p>
  </th>
  <th>Meaning</th>
  </tr>
  
  <tr>
  <td height="32">   driverName</td>
  <td height="32"> The name of the driver needed to connect to the database
  		</td>
  </tr>
  <tr>
  <td height="32">connectionURL</td>
  <td height="32"> 	The connection URL used to connect to the database
  </td>
  </tr>
  <tr>
  <td height="32">userTable</td>
  <td> 		The user's tables
  </td>
  </tr>
  <tr>
  <td height="32">userNameCol</td>
  <td> 		The column in the user's table that contains the name
  </td>
  </tr>
  <tr>
  <td height="32">userCredCol</td>
  <td> 		The column in the user's table that contains the password
  </td>
  </tr>
  <tr>
  <td height="33">userRoleTable</td>
  <td height="33"> 	The user's roles table
  </td>
  </tr>
  <tr>
  <td height="32">roleNameCol</td>
  <td> 		The column in the user's table that contains a role given
                        	to a user
  </td>
  </tr>
  
  <tr>
  <td height="32">      connectionName</td>
  <td> The name to use when connecting to the database.
  (Optional)</td>
  </tr>
  <tr>
  <td height="32">connectionPassword</td>
  <td>The password to use when connecting to the database.
  (Optional)
  </td>
  </tr>
  <tr>
  <td height="32">Digest       </td>
  <td>The algorithm used for digest passwords or &quot;No&quot; for plain passwords, the values can be &quot;MD5&quot;, etc... (Optional) </td>
  </tr>
  </table>
  <p>&nbsp;</p>
  <p>Done!!
  </p>
  <h2>Using digested passwords</h2>
  <p>To use digested password you need to store them digested.
  To achieve this, you will  need to use the same digest strategies that JDBCrealm uses to store the passwords, inside JDBCRealm there is a static method with signature <code>final public static String Digest(String password,String algorithm)</code> this method is provided as a tool to be used outside JDBCRealm by an application that want to store passwords readable by JDBCRealm.</p>
  <h2>Hints</h2>
  <p>
     
     - Make sure that the JDBC driver is in the lib directory.
  <br>
  - If you have problem connecting you can specify connectionName and connectionPassword</p>
  <div align="center">$Header: /home/cvs/jakarta-tomcat/src/doc/JDBCRealm-howto.html,v 1.1 2000/09/01 22:44:45 nacho Exp $
  </div>
  </body>
  </html>