| Back | Next | Contents | Cams Administrator's Guide |
Cams uses the Java Authentication and Authorization Service (JAAS) to provide user authentication services. JAAS was introduced as an optional package to the Java 2 SDK, Standard Edition (J2SDK) 1.3. This was also known as JAAS 1.0. JAAS was officially integrated into the J2SDK with the 1.4. Cams does not use the authorization features of JAAS.
The JAAS authentication API defines a Java version of the Pluggable Authentication Module (PAM) framework, which permits applications to remain independent from underlying authentication technologies. The PAM framework allows the use of new or updated authentication technologies without requiring modification to applications.
This chapter describes how to configure Cams login modules. See also the Login Configuration Tag Reference for more information on all the XML tags used in the login-config.xml file.
NOTE: If an existing Cams login module does not meet your needs, then you may want to consult the Programming Cams JAAS Login Modules chapter of the Cams Programmer's Guide to understand how to create a new Cams login module. Source code is provided as a reference for all existing Cams Login Modules.
Each Cams security domain must have a login configuration defined by a login-config.xml file, which is loaded by Cams during login module initialization. The login-config.xml file contains both required and optional data, specific to each login module. One or more login module configurations can be specified by nesting values within one or multiple <login-config-entry name="name"> and </login-config-entry> tags, as you can see in the sample login-config.xml file. You invoke a configuration by starting the Cams service and referencing a specific <login-config-entry> name.
Within the <login-config-entry> open and close tags, you can specify how one more more login modules will be used for a configuration. The parameters className and flag are required for each login module entry as show in example 1. The class name specifies the fully qualified location of the Java class for the given login module. The login modules currently shipped with Cams include:
<login-config-entry name="http"> <login-module-entry className="com.cafesoft.cams.auth.login.module.XmlLoginModule" flag="REQUIRED"> <options> <option name="serviceId" value="cams-user-repository"/> <option name="debug" value="true"/> </options> </login-module-entry> </login-config-entry> |
A <login-config-entry> can have one or more <login-module-entry>. The flag parameter determines the behavior when multiple login modules are used by specifying whether a module is required, requisite, sufficient, or optional.
Specifying more than one <login-module-entry> for a single <login-config-entry> configuration is also known as stacking. The interaction between flags when stacking is complicated. It is recommended that you keep these configurations as simple as possible. In most cases, you'll specify a single login module with flag value of REQUIRED.
The optional values are specific to each login module and will be explained below in the sections for each login module. All options tags require name and value parameters. For example, all Cams login modules include a debug option to toggle on/off debug. The tag is <option name="debug" value="true"/> with the value either true or false.
The login modules included with Cams are:
Password digests are one-way hashes that securely store a password using secure, industry standard hashing algorithms. Cams login modules that retrieve the password value from the database implement support for Cams to do digests within the login module. In this case, when a user supplies a password for authentication the Cams login module determines how the password in the user directory was hashed and then uses the same formula to hash the password to be validated. If the resulting digest is the same as the digest stored in the user directory, the user is authenticated.
Cams provides supports for Unix Crypt, SHA (with and without salt), and MD5 (with and without salt) digests. Typically, encryption authorities today recommend use of the SHA algorithm with random salt bytes. For more information on how Cams implements support of digest, see the Password Digests appendix.
You use this login module to access user data that is stored in the Microsoft Active Directory server. Active Directory, like most directory servers, can be configured to support virtually any schema. The Cams Active Directory login module provides support for the default Active Directory schema as shown in example 2.
| Tree Structure | Active Directory Objects |
|---|---|
|
cn=Users,dc=company,dc=com
|
Users:
Groups:
|
The Active Directory login module expects to find a schema as shown in example 2, with the user values stored in specific attributes. The steps the Active Directory login module must successfully perform are:
Example 3 shows the sample entry for the Active Directory login module.
<login-module-entry |
The required Active Directory login module options values are:
You use this login module to access user repository information that is stored in SQL databases such as Oracle, DB2, Microsoft SQL, MySQL, Sybase, and virtually any other database with a JDBC driver. The sample configuration uses the JDBC to ODBC bridge that ships with the JDK to access a Windows datasource (DSN) named SampleJdbcLogin. You can configure the sample Microsoft Access database with the SampleJdbcModule DSN to test the JDBC login module. Example 4 shows the sample entry for the JDBC login module.
<login-module-entry
className="com.cafesoft.cams.auth.login.module.JdbcLoginModule"
flag="REQUIRED">
<options>
<option name="debug" value="false"/>
<option name="jdbcDriver" value="sun.jdbc.odbc.JdbcOdbcDriver"/>
<option name="jdbcUrl" value="jdbc:odbc:SampleJdbcLogin"/>
<option name="jdbcUsername" value="sa"/>
<option name="jdbcPassword" value="password"/>
<option name="userPreparedStatement"
value="SELECT PASSWORD FROM USERS WHERE USERNAME = ? "/>
<option name="passwordColumn" value="PASSWORD"/>
<option name="rolePreparedStatement"
value="SELECT ROLE FROM USER_ROLES WHERE USERNAME = ? "/>
<option name="roleColumn" value="ROLE"/>
</options>
</login-module-entry>
<callback-handler classname="com.cafesoft.cams.auth.callback.NamePasswordCallbackHandler"/>
|
Example 4 - Cams Jdbc login module sample
The required JDBC login module options values are:
The JDBC login module supports password digests using Unix Crypt, MD5, and SHA, SMD5, and SSHA. The algorithm is specified within curly brackets in a label that precedes a base 64 encoding of the hashed password (e.g., {CRYPT}, {MD5}, {SHA}, {SMD5}, {SSHA}), which may also include salt bytes.
NOTE: If you need to use a JDBC driver other than the JDBC to ODBC bridge that ships with the J2SDK, you must supply and install the driver. To use the JDBC driver with Cams, copy the driver's jar file the CAMS_HOME/cams/lib directory. Under Linux/UNIX, you will also need to edit runcams.sh and add the driver to the classpath. You can alternatively copy the driver to the ext directory of your J2SDK installation. For example, if you want to use MySQL with the standard J2SDK installation, you would copy mm.mysql-2.0.14-bin.jar to JAVA_HOME/jre/lib/ext.
To use JDBC connection pooling from the JDBC login module, you must:
<login-module-entry
className="com.cafesoft.cams.auth.login.module.JdbcLoginModule"
flag="REQUIRED">
<options>
<option name="debug" value="false"/>
<option name="jdbcDriver" value="com.cafesoft.core.jdbc.PoolingConnectionDriver"/>
<option name="jdbcUrl" value="jdbc:cafesoft:pool:myusersdb_pool"/>
<option name="jdbcUsername" value="my_pool_user"/>
<option name="jdbcPassword" value="my_pool_password"/>
<option name="userPreparedStatement"
value="SELECT PASSWORD FROM USERS WHERE USERNAME = ? "/>
<option name="passwordColumn" value="PASSWORD"/>
<option name="rolePreparedStatement"
value="SELECT ROLE FROM USER_ROLES WHERE USERNAME = ? "/>
<option name="roleColumn" value="ROLE"/>
</options>
</login-module-entry>
|
Example 5 - Using pooled JDBC connections with the JDBC login module
All other JDBC login module values are configured as shown in example 2.
You use this login module to access user data that is stored in a directory such as SunOne Directory Server, OpenLDAP, and most other LDAPv3 compliant directories. LDAP directory schema will vary from site to site. This login module supports X.500 and DNS schemas that are similar to those that originated from the University of Michigan LDAP server and Netscape as shown in example 6.
| Tree Structure | LDAP Objects |
|---|---|
|
dc=company,dc=com
|
Users:
Groups:
|
The LDAP login module expects to find a schema similar to the one specified in example 6. The steps the LDAP login module must successfully perform are:
The LDAP login module configuration options include parameters to flexibily query user and role information from many LDAP schemas. Your LDAP server may use a schema slightly different from the one specified above that will still work with the LDAP login module. Also, issues with respect to your site LDAP server access control policy may effect the integration with Cams. The recommended approach is to use a general purpose LDAP search tool (usually supplied with your LDAP server) to ensure that your searches return the expected results. Once you acheive success, you can enter the values in login-module.xml and test with Cams. For example, searches such as:
base distinguished name: ou=People,dc=company,dc=com
filter: (ou=myUserName,ou=People,dc=company,dc=com)
scope: one
attributes: userPassword
can be used to determine if the userPassword value can be returned for a user. If your search tool supports sepecification of calling the compare method, you can use similar values with it to determine if a compare can be done. Searches such as:
base distinguished name: ou=Groups,dc=company,dc=com
filter: (uniqueMember=uid=myUserName,dc=company,dc=com)
scope: one
attributes: cn
can be used to determine the roles.
Example 7 shows the sample entry for the LDAP login module.
<login-module-entry className="com.cafesoft.cams.auth.login.module.LdapLoginModule" flag="REQUIRED"> <options> <option name="debug" value="false"/> <option name="host" value="host.company.com"/> |
Example 7 - Cams LDAP login module login-config.xml sample
The required LDAP login module options values are:
You use this login module to access user data that is stored in the Microsoft Site Server LDAP directory. Site Server LDAP directory, like most directory servers, can be configured to support virtually any schema. The Cams Site Server login module provides support for the default Site Server LDAP directory schema as shown in example 8.
| Tree Structure | LDAP Objects |
|---|---|
|
o=company.com
|
Users:
Groups:
|
The Site Server login module expects to find a schema as shown in example 8, with the user values stored in specific attributes. The steps the Site Server login module must successfully perform are:
Example 9 shows the sample entry for the Site Server login module.
<login-module-entry className="com.cafesoft.cams.auth.login.module.LdapLoginModule" flag="REQUIRED"> <options> <option name="debug" value="false"/> <option name="host" value="host.company.com"/> |
Example 9 - Cams LDAP login module login-config.xml sample
The required SiteServer login module options values are:
Example 10 shows the sample entry for the XML login module. You use this login module to access user data stored in a cams-users.xml directory, found by default in each security domain. This user directory is supplied with Cams for convenience and is not recommend for a large number of users as the entire contents of the file are read into memory.
The XML login module does not process the contents of the cams-users.xml file directly. Instead, it makes use of a Cams service, which loads the XML file and reloads it if modifications are made. This Cams service (defined in security-domain.xml) caches username, password, and role information in memory, greatly improving the efficiency of authentication. The path to Cams user directory and the XML handler that knows how to parse the file are specified in the service manager configuration.
<!-- In login-config.xml, register a cams-users.xml directory service --> <login-config-entry> ... <login-module-entry className="com.cafesoft.cams.auth.login.module.XmlLoginModule" flag="REQUIRED"> <options> <option name="debug" value="false"/> <option name="serviceId" value="cams-user-repository"/> </options> </login-module-entry> ... <login-config-entry> |
Example 10 - Sample Cams XML login module as defined in login-config.xml and by the associated security-domain.xml service
The required XML login module options values are:
The XML login module supports password digests using Unix Crypt, MD5, and SHA, SMD5, and SSHA. The algorithm is specified within curly brackets in a label that precedes a base 64 encoding of the hashed password (e.g., {CRYPT}, {MD5}, {SHA}, {SMD5}, {SSHA}), which may also include salt bytes. See Password Digests for more information.
See Security Domain Configuration - Cams XML User Repository Service for information on how to configure services.
Cams uses callback handlers to pass login credentials from the calling application to the login module. In the web or HTTP space, most webapps use form authentication, typically requesting a username and password for authentication. In this case you can use the Cams NamePasswordCallbackHandler, which takes a username and password as input and provides them to the login module. It is possible to create login modules that require many types of credentials. In some cases you may need to write and register your own callback handler.
To specify a callback handler for use with a Cams login module, each login-config-entry includes the following required tag:
<callback-handler
classname="com.cafesoft.cams.auth.callback.NamePasswordCallbackHandler"/>
The Cams JDBC, LDAP, and XML login modules all require the callback handler to supply a username and password. These login modules work well with the NamePasswordCallbackHandler. However, Cams has a pluggable callback framework to associate custom callback handlers with login modules. If the NamePasswordCallbackHandler does not meet your needs, see the Cams Callback Handlers chapter of the Cams Programmer's Guide to understand how to create a new one. For example, you may want to specify a third authentication credential in addition to username and password, such as the last four digits of a user's social security number or a pin.
Login parameters are optional tags that further define the login configuration. As shown in example 11, the Cams server will redirect to the login page specified by the camsLoginUrl when user authentication is required. This can be an absolute or relative URL. Any server with a Cams web agent can be used as the Cams authentication server provided the server is in the same Internet domain.
<login-parameters> <login-parameter name="camsLoginUrl" value="/cams/login.jsp"/> </login-parameters> |
Example 11 - Cams login parameters
NOTE: The value /cams/login.jsp
is provided by default. You must change this value to correspond to the login
page in use at your site. For example, IIS sites might use /cams/login.asp
and Apache sites might use
/cgi-bin/cams-login.sh.
© Copyright 1996-2003 Cafésoft LLC. All rights reserved.