Plugin Configuration

This section describes where to customize the authentication plugin in the Sybase CEP Server configuration file, and provides a sample configuration section.

The authentication plugin is declared in the SybaseC8/Security/AccessControl/Authentication/Plugin section of the Sybase CEP Server configuration file named c8-server.conf. Below is a sample configuration section. You can customize the actual names of the library file and the three functions, all of which are boldfaced in the listing below.

<section name="AccessControl"> 
  ...
  <section name="Authentication"> 
     <!-- Sample authentication plugin configuration -->
     <section name="Plugin"> 
       <preference name="LibraryName" 
                   value="
c8authplugin_demo_lib
"/> 
       <preference name="InitializeFunction" 
                   value="
c8authplugin_demo_initialize
"/> 
       <preference name="AuthenticateFunction" 
                   value="
c8authplugin_demo_authenticate
"/> 
       <preference name="ShutdownFunction" 
                   value="
c8authplugin_demo_shutdown
"/> 
     </section> 
   </section>
 </section>

Custom configuration parameters can be passed to a plugin by specifying a preference with any name in the SybaseC8/Security/AccessControl/Authentication/Plugin section of the server configuration file named c8-server.conf. For example, in the htpasswd plugin provided by Sybase CEP, the paths and names of the htpasswd and htgroup files are specified this way. A generic example is shown below:

<section name="AccessControl"> 
    ...
     <section name="Authentication"> 
         ...
         <section name="Plugin"> 
             ...
             <preference name="MyPreference" 
                         value="MyValue"/> 
         </section> 
     </section> 
 </section>

You can then call the following function to read the preference:

/**
 * Gets specified preference from server config file.
 * The caller is responsible for de-allocating the returned value.
 * 
 * @param pref - name of preference to read
 *               (under SybaseC8/Security/AccessControl/Authentication/)
 * @param def_val - default value to return if preference is not present
 * @return - string value of preference (copy of default if not present).
 */
C8Char* C8AuthPluginGetPreference (C8AuthPlugin *plugPtr, 
                                   const C8Char *pref, 
                                   const C8Char *def_val);

For example, to read the "MyPreference" preference above, one would call:

C8Char *pref = C8AuthPluginGetPreference(plugPtr, "MyPreference", 
                                                  "default");