| Back | Next | Contents | Cams Administrator's Guide |
The Cams documentation download includes an examples.zip file that contains source code for useful Cams policy server pluggin examples and some components such as Cams login modules. All Cams policy server examples are included in compiled format in the CAMS_HOME/lib directory and are available for immediate configuration if no modifications are required. Because many Cams customers find these examples both convenient and useful as is, this document describes how to configure and use the most popular Cams examples. Examples not documented here are found in the Cams Programmer's Guide.
A component that plugs into the Cams manage session event service (configured in security-domain.xml) to add user-specific values to a Cams session using a SQL database query. For example, after a session is successfully created, you might query values such as a users employee ID or country. These values then are useful throughout the user session for webapp personalization, fine-grained access controls and custom Cams access control rules.
Cams makes session information available to webapps using secure HTTP request headers. Cams composes the HTTP header name for each value using the prefix CAMS-HTTP-, then the namespace followed by a dash and the value name. For example, a session value of EMPLOYEE_ID in the namespace USERINFO would be available in the header named:
CAMS-HTTP-USERINFO-EMPLOYEE_ID
Some web servers such as Apache and IIS convert dashes to underscores and prepend HTTP_ to each value. For example, and ASP.NET, PERL, PHP, or shell programmer could expect to find the value for CAMS-HTTP-USERINFO-EMPLOYEE_ID using the name HTTP_CAMS_HTTP_USERINFO_EMPLOYEE_ID.
This Cams component queries configurable user-specific data from a relational database and inserts the corresponding result set name/value pairs as attributes into a Cams session. The database column names are used for the attribute name. Result sets should only return one row as only the first row of the result set is processed.
Example 1 shows how to register and configure the example JdbcUserAttributeManagedSessionEventHandler by adding the <session-event-handler> element and attributes to the <session-manager-service> in security-domain.xml.
<!-- Configure the session manager service -->
<session-manager-service
className="com.cafesoft.security.engine.session.StandardSessionManager">
...
<session-event-handler
className="examples.session.JdbcUserAttributeManagedSessionEventHandler">
|
Example 1 - Register the JDBC User Attribute Managed Session Event Handler example within a security domain
The parameters for this example are:
NOTE: Example 1 shows use of a JDBC driver provided by Cams that pools JDBC Connections and can dramatically improve performance and scalability for session event handlers. For more information, see section Using JDBC Connection Pooling in the Cams Administrator's Guide.
A component that plugs into the Cams manage session event service (configured in security-domain.xml) to to fetch the previous last login value and set a new one using SQL database queries. This component is useful when SQL databases are the configured user direction and features similar to those found in LDAP servers and Active Directory are desired to track a user's last successful login.
Cams makes session information available to webapps using secure HTTP request headers. Cams composes the HTTP header name for each value using the prefix CAMS-HTTP-, then the namespace followed by a dash and the value name. For example, a session value of LAST_LOGIN in the namespace USERINFO would be available in the header named:
CAMS-HTTP-USERINFO-LAST_LOGIN
Some web servers such as Apache and IIS convert dashes to underscores and prepend HTTP_ to each value. For example, and ASP.NET, PERL, PHP, or shell programmer could expect to find the value for CAMS-HTTP-USERINFO-LAST_LOGIN using the name HTTP_CAMS_HTTP_USERINFO_LAST_LOGIN.
Example 2 shows how to register and configure the example LastLoginManagedSessionEventHandler by adding the <session-event-handler> element and attributes to the <session-manager-service> in security-domain.xml.
<!-- Configure the session manager service -->
<session-manager-service
className="com.cafesoft.security.engine.session.StandardSessionManager">
...
<session-event-handler
className="examples.session.JdbcLastLoginManagedSessionEventHandler">
|
Example 2 - Register the JDBC Last Login Managed Session Event Handler example within a security domain
The parameters for this example are:
NOTE: Example 2 shows use of a JDBC driver provided by Cams that pools JDBC Connections and can dramatically improve performance and scalability for session event handlers. For more information, see section Using JDBC Connection Pooling in the Cams Administrator's Guide.
A component that plugs into the Cams manage session event service (configured in security-domain.xml) to add user-specific values to a Cams session using a LDAP search filter. For example, after a session is successfully created, you might query values such as a users employee ID or country. These values then are useful throughout the user session for webapp personalization, fine-grained access controls and custom Cams access control rules.
Cams makes session information available to webapps using secure HTTP request headers. Cams composes the HTTP header name for each value using the prefix CAMS-HTTP-, then the namespace followed by a dash and the value name. For example, a session value of COUNTRY in the namespace USERINFO would be available in the header named:
CAMS-HTTP-USERINFO-COUNTRY
Some web servers such as Apache and IIS convert dashes to underscores and prepend HTTP_ to each value. For example, and ASP.NET, PERL, PHP, or shell programmer could expect to find the value for CAMS-HTTP-USERINFO-COUNTRY using the name HTTP_CAMS_HTTP_USERINFO_COUNTRY.
This component queries configurable user-specific data from a LDAP server and inserts the corresponding result set name/value pairs as attributes into a Cams session. The LDAP attribute names are used for the Cams session attribute name. If multiple attribute values are returned for a given attribute, only the first value is used.
Example 3 shows how to register and configure the example LdapUserAttributeManagedSessionEventHandler by adding the <session-event-handler> element and attributes to the <session-manager-service> in security-domain.xml.
<!-- Configure the session manager service -->
<session-manager-service
className="com.cafesoft.security.engine.session.StandardSessionManager">
...
<session-event-handler
className="examples.session.LdapUserAttributeManagedSessionEventHandler">
|
Example 3 - Register the LDAP User Attribute Managed Session Event Handler example within a security domain
The parameters for this example are:
A component that plugs into the Cams manage session event service (configured in security-domain.xml) to send a text message when user's with a specified role login. By default, this example sends the text message to a specified email address using a Cams SMTP notifier service. Information on the configuration of both components is provided.
Example 4 shows how to register and configure the example RoleLoginNotifier by adding the <session-event-handler> element and attributes to the <session-manager-service> in security-domain.xml.
<!-- Configure the session manager service -->
<session-manager-service
className="com.cafesoft.security.engine.session.StandardSessionManager">
...
<session-event-handler
className="examples.session.examples.service.RoleLoginNotifier">
|
Example 4 - Register the Role Login Notifier example within a security domain
The parameters for this example are:
Example 5 shows how to register and configure the example SmtpTextNotifierService, which is used by the RoleLoginNotifier to send a text message, by adding the <service> element and attributes to the <service-manager> in security-domain.xml.
<!-- Register services accessible within this security domain --> <service-manager |
Example 5 - Register the SMTP Text Notifier Service example within a security domain
The parameters for this example are:
© Copyright 1996-2008 Cafésoft LLC. All rights reserved.