Skip to content

2.2. Settings

Each setting can be supplied in three waysweb.xml (or addInitParameter), an environment variable, or a JVM system property. The result is the same whichever you use.

The "Settings and Defaults" section below lists the names as they appear in web.xml. The names to use for environment variables and system properties are in the "Name Mapping" table that follows.

If more than one is used at the same time, they take precedence in this order.

1. Environment variable KSM_SESSION_TIMEOUT ← strongest
2. System property ksm.session.timeout
3. web.xml <param-name>sessionTimeout

This is useful when the same image is deployed to several environments (development, staging, production). You can adjust behavior by changing only the environment variables, leaving the application untouched.

The renaming rule is to insert a separator at word boundaries — sessionTimeoutKSM_SESSION_TIMEOUT (environment variable) → ksm.session.timeout (system property).

The values in web.xml can themselves use ${variable:default}. For example, <param-value>${session.timeout:30}</param-value> uses the value of the system property session.timeout if it exists, and 30 otherwise.

Settings and Defaults

The defaults are those in KhanSessionFilter.getSessionFilterConfig() in the source. If you omit a setting, this value is used.

Store Connection

Setting nameDescriptionDefault
configFileName of the file holding the session store connection information (the file created in step 2)None — you must provide it. Without it, startup fails with an error
infinispanCacheName of the cache holding session metadataKHAN_SESSION
infinispanLoginCacheName of the cache holding session dataKHAN_SESSION_LOGIN
namespacePrefix added to store keys. Distinguishes systems when several share one storeKHAN

Cookies

Setting nameDescriptionDefault
sessionIdName of the cookie that identifies the session. The WAS JSESSIONID is left as it is and this cookie is added; this value is what is used to find the session in the data grid__KSMSID__
domainDomain across which the session is shared. Hosts that differ only by subdomain can share it (for example, login.openmaru.io and www.openmaru.io)(none)
pathPath across which the session is shared. Set it to / to share between different web applications/
secureThe cookie's Secure flag. Sends the cookie over HTTPS onlyfalse
httpOnlyThe cookie's HttpOnly flag. Prevents JavaScript from reading the cookiefalse
sameSiteThe cookie's SameSite attribute(none)

Session Behavior

Setting nameDescriptionDefault
sessionTimeoutSession timeout in minutes. A non-numeric value falls back to the default and an error is recorded in the log10
sessionSaveDelayHow long to defer writing the session to the store, in seconds. 0 means no delay0
excludeRegExpRequest paths for which no session is created (regular expression). Prevents sessions from being created for static files such as images and CSS(none — if omitted, a session is created for every request)
enableImmediateSaveWhen true, saves to the store immediately on every setAttribute() callfalse
enableImmediateReadWhen true, reads directly from the store every time a session value is readfalse
useLibraryModeRuns in library mode. Not used in remote data grid modefalse
useAuthenticatorUses WAS authentication integrationfalse

Duplicate Login

Setting nameDescriptionDefault
allowDuplicateLoginWhether duplicate logins are allowed. The default is false, so duplicate login prevention is on from the start. Set true to allow themfalse
duplicateLoginPolicyDuplicate login policy. none does nothing, legacy logs out the previously logged-in user, and custom manages duplicates as a list of sessions. If allowDuplicateLogin is true, this value is ignored and fixed at legacylegacy
invalidateDuplicateLoginWhether to invalidate the existing session automatically when a duplicate login is found. When false, the session is kept and the user is only sent to the logout URLfalse
duplicateLoginExclustionTypeUser types excluded from the duplicate login check. Separate several with commas(none)
logoutUrlLogout URL to send the user to when a duplicate login is found. If left empty, the user is not redirected(empty string)

Monitoring

Setting nameDescriptionDefault
enableStatisticsExposes session metrics as MBeans. On by default. Set false to turn it offtrue
enableMemoryStatisticsAlso measures session memory usage. Requires the Java agent to be configuredfalse

Name Mapping

These are the names to use when supplying the same setting as an environment variable or a JVM system property.

Setting name (web.xml)Environment variableJVM system property
configFileKSM_CONFIG_FILEksm.config.file
namespaceKSM_NAMESPACEksm.namespace
infinispanCacheKSM_INFINISPAN_CACHEksm.infinispan.cache
infinispanLoginCacheKSM_INFINISPAN_LOGIN_CACHEksm.infinispan.login.cache
sessionIdKSM_SESSION_IDksm.session.id
domainKSM_DOMAINksm.domain
pathKSM_PATHksm.path
secureKSM_SECUREksm.secure
httpOnlyKSM_HTTP_ONLYksm.http.only
sameSiteKSM_SAME_SITEksm.same.site
sessionTimeoutKSM_SESSION_TIMEOUTksm.session.timeout
sessionSaveDelayKSM_SESSION_SAVE_DELAYksm.session.save.delay
excludeRegExpKSM_EXCLUDE_REG_EXPksm.exclude.reg.exp
allowDuplicateLoginKSM_ALLOW_DUPLICATE_LOGINksm.allow.duplicate.login
duplicateLoginPolicyKSM_DUPLICATE_LOGIN_POLICYksm.duplicate.login.policy
invalidateDuplicateLoginKSM_INVALIDATE_DUPLICATE_LOGINksm.invalidate.duplicate.login
duplicateLoginExclustionTypeKSM_DUPLICATE_LOGIN_EXCLUSTION_TYPEksm.duplicate.login.exclustion.type
logoutUrlKSM_LOGOUT_URLksm.logout.url
enableImmediateSaveKSM_ENABLE_IMMEDIATE_SAVEksm.enable.immediate.save
enableStatisticsKSM_ENABLE_STATISTICSksm.enable.statistics
enableMemoryStatisticsKSM_ENABLE_MEMORY_STATISTICSksm.enable.memory.statistics
enableImmediateReadKSM_ENABLE_IMMEDIATE_READksm.enable.immediate.read
useLibraryModeKSM_USE_LIBRARY_MODEksm.use.library.mode
useAuthenticatorKSM_USE_AUTHENTICATORksm.use.authenticator

configFile can also be specified through the OPENMARU_CONFIG_FILE environment variable.