The JAAS LDAP login module enables you to store user data in an LDAP database. To manage
the stored user data, use a standard LDAP client tool. The jaas:* console
commands are not supported.
For more details about using LDAP with Fuse ESB Enterprise, see LDAP Authentication Tutorial.
The JAAS LDAP Login Module authenticates username/password credentials, returning the list of roles associated with the authenticated user.
The following classes implement the JAAS LDAP Login Module:
org.apache.karaf.jaas.modules.ldap.LDAPLoginModuleImplements the JAAS login module.
![]() | Note |
|---|---|
There is no backing engine factory for the LDAP Login Module, which means that this
module cannot be managed using the |
The JAAS LDAP login module supports the following options:
connection.urlThe LDAP connection URL—for example,
ldap://hostname.connection.usernameAdmin username to connect to the LDAP server. This parameter is optional: if it is not provided, the LDAP connection will be anonymous.
connection.passwordAdmin password to connect to the LDAP server. Used only if the
connection.usernameis also specified.user.base.dnThe LDAP base DN used to look up roles—for example,
ou=role,dc=apache,dc=org.user.filterThe LDAP filter used to look up a user's role—for example,
(member:=uid=%u).user.search.subtreeIf
true, the user lookup is recursive (SUBTREE). Iffalse, the user lookup is performed only at the first level (ONELEVEL).role.base.dnThe LDAP base DN used to look up roles—for example,
ou=role,dc=apache,dc=org.role.filterThe LDAP filter used to look up a user's role—for example,
(member:=uid=%u).role.name.attributeThe LDAP role attribute containing the role value used by Apache Karaf—for example,
cn.role.search.subtreeIf
true, the role lookup is recursive (SUBTREE). Iffalse, the role lookup is performed only at the first level (ONELEVEL).authenticationDefine the authentication back-end used on the LDAP server. The default is
simple.initial.context.factoryDefine the initial context factory used to connect to the LDAP server. The default is
com.sun.jndi.ldap.LdapCtxFactory.sslIf
trueor if the protocol on theconnection.urlisldaps, an SSL connection will be used.ssl.providerSpecifies the SSL provider.
ssl.protocolThe protocol version to use—for example,
SSLorTLS.ssl.algorithmThe algorithm to use for the
KeyManagerFactoryand theTrustManagerFactory—for example,PKIX.ssl.keystoreThe ID of the keystore that stores the LDAP client's own X.509 certificate (required only if SSL client authentication is enabled on the LDAP server). The keystore must be deployed using a
jaas:keystoreelement (see Sample Blueprint configuration).ssl.keyaliasThe keystore alias of the LDAP client's own X.509 certificate (required only if there is more than one certificate stored in the keystore specified by
ssl.keystore).ssl.truststoreThe ID of the keystore that stores trusted CA certificates, which are used to verify the LDAP server's certificate (the LDAP server's certificate chain must be signed by one of the certificates in the truststore). The keystore must be deployed using a
jaas:keystoreelement.
The following Blueprint configuration shows how to define a new karaf realm
using the LDAP 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">
<!-- Allow usage of System properties, for example the karaf.home property -->
<ext:property-placeholder placeholder-prefix="${" placeholder-suffix="}"/>
<jaas:config name="karaf" rank="2">
<jaas:module className="org.apache.karaf.jaas.modules.ldap.LDAPLoginModule"
flags="required">
connection.url = ldaps://localhost:10636
user.base.dn = ou=users,ou=system
user.filter = (uid=%u)
user.search.subtree = true
role.base.dn = ou=groups,ou=system
role.filter = (uniqueMember=uid=%u)
role.name.attribute = cn
role.search.subtree = true
authentication = simple
ssl.protocol=SSL
ssl.truststore=ks
ssl.algorithm=PKIX
</jaas:module>
</jaas:config>
<jaas:keystore name="ks"
path="file:///${karaf.home}/etc/trusted.ks"
keystorePassword="secret" />
</blueprint>





![[Note]](imagesdb/note.gif)


