The JAAS properties login module stores user data in a flat file format (where the
stored passwords can optionally be encrypted using a message digest algorithm). The user
data can either be edited directly, using a simple text editor, or managed using the
jaas:* console commands.
For example, a standalone container uses the JAAS properties login module by default and
stores the associated user data in the
file.InstallDir/etc/users.properties
The JAAS properties login module authenticates username/password credentials, returning the list of roles associated with the authenticated user.
The following classes implement the JAAS properties login module:
org.apache.karaf.jaas.modules.properties.PropertiesLoginModuleImplements the JAAS login module.
org.apache.karaf.jaas.modules.properties.PropertiesBackingEngineFactoryMust be exposed as an OSGi service. This service makes it possible for you to manage the user data using the
jaas:*console commands from the Apache Karaf shell (see JAAS Console Commands in Console Reference).
The JAAS properties login module supports the following options:
usersLocation of the user properties file.
The user properties file is used to store username, password, and role data for the properties login module. Each user is represented by a single line in the user properties file, where a line has the following form:
Username=Password[,Role][,Role]...
The following Blueprint configuration shows how to define a new karaf realm
using the properties login module, where the default karaf realm is overridden
by setting the rank attribute to 2:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:jaas="http://karaf.apache.org/xmlns/jaas/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
<type-converters>
<bean class="org.apache.karaf.jaas.modules.properties.PropertiesConverter"/>
</type-converters>
<!-- Allow usage of System properties, especially the karaf.base property -->
<ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
<jaas:config name="karaf" rank="2">
<jaas:module className="org.apache.karaf.jaas.modules.properties.PropertiesLoginModule"
flags="required">
users = $[karaf.base]/etc/users.properties
</jaas:module>
</jaas:config>
<!-- The Backing Engine Factory Service for the PropertiesLoginModule -->
<service interface="org.apache.karaf.jaas.modules.BackingEngineFactory">
<bean class="org.apache.karaf.jaas.modules.properties.PropertiesBackingEngineFactory"/>
</service>
</blueprint>Remember to export the BackingEngineFactory bean as an OSGi service, so
that the jaas:* console commands can manage the user data.








