ParaChat User Authentication Interface

ParaChat User Authentication Interface


Overview

By default ParaChat server authenticates user logins based on ParaChat's own user profiles. User profiles are stored under "users" directory, with one profile per user. A user login is successful when the user's profile is found under "users" directory and the password user entered matches the password in the profile file

An admin user is created when ParaChat is installed. This user name is called "admin" with profile stored in "admin.profile" under "users" directory.

The data flow of user authentication as is follows

  • User enters name and password in chat applet of a web browser.
  • Chat server looks up local file system.
  • Chat server responds to the applet with Success or Failure of login.
ParaChat user authentication interface is designed to provide an interface in Java for authenticating external users. For example, you may want to authenticate users stored in a database, or users in a directory service such as LDAP and Microsoft Active Directory Service .

In this case, the authentication flow is as follows.

  • User enters name and password in chat applet of a web browser.
  • Chat server looks up local file system. If user is found, authentication is done. Otherwise, go to step 3.
  • Chat server retrieves user data with an authentication module which implements ParaChat user authentication interface.
  • Chat server decides whether authentication is successful based on the user data obtained in step 3.

User Name Case Sensitivity

User names are case insensitive by default. When you create users manually under ParaChat server directory "users", make sure the file names are all in lower case. This applies mainly to Unix systems as Windows file systems are case insensitive.

ParaChat User Authentication Interface

The java interface can be found here.

Setup of an External User Authentication

First, we show you the steps you need to go through to set up an external user authentication, supposing you have implemented this interface. We go into some details of implementation by an example in the next section.

Suppose the external user authentication you have implemented is:

    "com.parachat.database.DatabaseUserAuth"

This class is the entry point. Usually you have more class files for this implementation bundled in the same package "com.parachat.database". Suppose you put them into a jar file as "database.jar".

Step 1.   Install ParaChat server. See ParaChat documents for instructions.

Step 2.   Open "config/pchatd.conf" file in a text editor. Find  "# Add your new config below." and add this line

    pchatd.UserAuth.class=com.parachat.database.DatabaseUserAuth

    This tells the ParaChat server to use this class "DatabaseUserAuth" for user authentication.

Step 3.   Update Java class path so that this new class can be loaded.

    Unix/Linux
    1. Open "parachatd.sh". Find comment below, and update the "zipname".
    2. Note: "database.jar" is the database driver you need to provide. Check with your database vendor for this file.
    3. # parachat Java classes

      zipname=chat450.jar:database.jar

    Windows

    1. Place "database.jar" into directory "ParaChat450".
    2. Open "install_service.bat" under "ParaChat450"
    3. Add this right after "set pJar=chat450.jar"

      set dbJar=database.jar

    4. Edit this line:

    ParaService.exe -i -Djava.class.path="%my_pwd%\%pJar%" wrkdir="%my_pwd%"

    1. Change it to:

ParaService.exe -i -Djava.class.path="%my_pwd%\%pJar%;%my_pwd%\%dbJar%" wrkdir="%my_pwd%"

If you have trouble setting up the class path, try to hard code Djava.class.path. On Windows, the format is:

    classpath1;classpath2...

See this page for more details. http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html

Step 3.   Shut down the ParaChat server and restart it. If you run it as a Windows service, you need to do the               following:

  • Shut down server.
  • Uninstall ParaChat service.
  • Install ParaChat service.
  • Start ParaChat service.

ParaChat User Authentication Implementations

ParaChat server is distributed with 2 implementations of user authentication. One is HTTP authentication which is a simple way of accessing an external user source. It is adequate for low usage of ParaChat server. Details can be found here: parachat_HTTP_auth.html

The other implementation is user authentication by a user database via JDBC. This section is focused on this implementation. For more about JDBC, see http://java.sun.com

Open "config/pchatd.conf" file in a text editor. Find  "# Add your new config below." and add these lines.

# database config.
pchatd.UserAuth.class=com.parachat.database.DatabaseUserAuth
pchatd.UserAuth.database.DriverClass=oracle.jdbc.driver.OracleDriver
pchatd.UserAuth.database.ConnectString=jdbc:oracle:thin:@123.456.789.000:1521:test
pchatd.UserAuth.database.UserName=test
pchatd.UserAuth.database.Password=secret
pchatd.UserAuth.database.Query=Select U.username as "pchatd.login", U.password as "pchatd.password" From user_table U where U.username=?
pchatd.UserAuth.database.Prepared=true
#pchatd.UserAuth.database.PasswordCaseSensitive=false
#pchatd.UserAuth.CaseSensitive=false
#pchatd.UserAuth.trace=true
#pchatd.UserAuth.database.Trace=true


The text in red is what we need to change. "oracle.jdbc.driver.OracleDriver " is the JDBC driver provided by your database vendor such as Oracle, MySQL, DB2, and MS SQL Server. In this case, it is an Oracle driver.

"pchatd.UserAuth.database.ConnectString" specifies the connection string to database. This is also dependent on the database you use.
"pchatd.UserAuth.database.UserName" and "pchatd.UserAuth.database.Password" are the user name and password for connecting to the database.

"pchatd.UserAuth.database.Query" is the query to retrieve a user's password from database. In this case, the table in the database is called "user_table" which has a column called "username" and a column called "password". This is a so called PreparedStatement in "java.sql" package. You should put one and only one question mark in the query.

Summary of Database Config
Key
Value
Default
pchatd.UserAuth.class
Java class name of an implementation of user authentication interface

pchatd.UserAuth.database.DriverClass
Database driver class

pchatd.UserAuth.database.ConnectString
Connection string to database

pchatd.UserAuth.database.UserName
User name to connect to database

pchatd.UserAuth.database.Password
Password to connect to database

pchatd.UserAuth.database.Query
Query to get a user's password

pchatd.UserAuth.database.Prepared
Whether query is a PreparedStatement
true
pchatd.UserAuth.database.PasswordCaseSensitive
Whether user passwords in database are case sensitive
true
pchatd.UserAuth.CaseSensitive
Whether user names in database are case sensitive. If case sensitive, user names are converted into lower case.
false
pchatd.UserAuth.trace=true
Whether to print debug info of user auth to standard out.
false
pchatd.UserAuth.database.Trace
Whether to print debug info of database user auth to standard out
false


Here is a sample config for a MySQL database. Note the user name and password are included in connect string.

# database config.
pchatd.UserAuth.class=com.parachat.database.DatabaseUserAuth
pchatd.UserAuth.database.DriverClass=com.mysql.jdbc.Driver
pchatd.UserAuth.database.ConnectString=jdbc:mysql://hostnameOrIP:3306/members?user=test&password=secret
#pchatd.UserAuth.database.UserName=test
#pchatd.UserAuth.database.Password=secret
pchatd.UserAuth.database.Query=Select U.username as "pchatd.login", U.password as "pchatd.password" From user_table U where U.username=?
pchatd.UserAuth.database.Prepared=true
#pchatd.UserAuth.database.PasswordCaseSensitive=false
#pchatd.UserAuth.CaseSensitive=false
#pchatd.UserAuth.trace=true
#pchatd.UserAuth.database.Trace=true


Before you restart your ParaChat server, you need to add your database driver classes to the class path. Usually your JDBC driver is provided as a jar file by your database vendor.
To add your JDBC driver, follow the step 2 in section "Setup of an External User Authentication".
The package of "com.parachat.database" is already included in chat450.jar of ParaChat server by default.


How to Make a Members only Chat Room


By default, a chat room allows non-member logins. That is to say, if a user is not found in "users" directory and is not in the external database, the user is allowed to login and chat. Members are still protected this way by password.

To make a room for members only, add this to the room you want to restrict to members only.

passwd.required=true

For more details, refer to: http://www.parachat.com/documentation/450/help/parachat/conf/roomnameconf.html


Authentication on ParaChat Web Based Admin Pages

ParaChat server has a set of web based admin pages that a super user manages users. The URL looks like,

    http://www.your_host_name.com:7877/plynx/parachat/index.lhtml

When a ParaChat server is configured with user authentication interface, the web based admin pages still work with the users stored under "users" directory. The web based admin pages does not write to the external database.

Note also when you create a new user on web based admin pages, you have blocked the same user name in the external database as local users are looked up first. For example, "admin" is created when ParaChat is installed. If you have a user called "admin" in the external database, you may want to rename the local "admin". To do this, simply change the file name of "admin.profile" to a different file name, for instance, "parachatadmin.profile".

Home | Hosting | Server | Features | Samples | Chat Now | Web Tools | Help | Affiliate

©1996 - 2006   M Square, Inc. |  Privacy Policy