如何在 Apache Karaf 3.0.3 中激活 LDAPLoginModule
how to activate LDAPLoginModule in Apache Karaf 3.0.3
我想在 apache karaf 3.0.3 中激活 Ldap 登录模块。
我的 karaf-jaas-module.xml 是 ;
.
.
.
<jaas:config name="karaf" rank="2">
<jaas:module className="org.apache.karaf.jaas.modules.ldap.LDAPLoginModule" flags="required">
initialContextFactory=com.sun.jndi.ldap.LdapCtxFactory
connection.username=admin
connection.password=xxxxxxx
connection.protocol=
connection.url=ldap://activedirectory_host:389
user.base.dn=cn=orcladmin,cn=users,dc=vmldapdevelop,dc=com
user.filter=(sAMAccountName=%u)
user.search.subtree=true
role.base.dn=ou=Groups,ou=there,DC=local
role.name.attribute=cn
role.filter=(member=%nsdn)
role.search.subtree=true
authentication=simple
</jaas:module>
</jaas:config>
.
.
.
并且我在 karaf 控制台中写了 jaas:realm-list,但没有看到 LdapLoginModule。
karaf@root()> jaas:realm-list
Index | Realm Name | Login Module Class Name
----------------------------------------------------------------------------
1 | karaf | org.apache.karaf.jaas.modules.properties.PropertiesLoginModule
2 | karaf | org.apache.karaf.jaas.modules.publickey.PublickeyLoginModule
我该怎么做?
我怀疑 xml 可能在包中的错误位置。它应该像其他蓝图上下文一样在 OSGI-INF/blueprint 中。您还需要在蓝图 xml.
的 header 中具有正确的命名空间定义
您可以通过执行 bundle:services 检查您的蓝图 xml 是否已处理。您应该会看到一个 BlueprintContainer 服务。如果不是,那么蓝图要么根本没有被拾取,要么扩展器发现错误。您可以使用 diag 命令显示蓝图错误。
是的,它在蓝图文件夹中。此文件夹位于 jaas_module 捆绑包中。但是在这个 xml 中改变任何东西,karaf 没有看到它。因为它覆盖了它。
我解决了我的问题。我创建了新的 xml 文件,名称为 ldap-module.xml 并且我的配置在其中。我把这个 xml 放在 deploy 文件夹中。
所以,我的新 xml 覆盖其他 xml,当我在 karaf 控制台上写 "jaas:realm-list" 时,我看到了这个输出;
__ __ ____
/ //_/____ __________ _/ __/
/ ,< / __ `/ ___/ __ `/ /_
/ /| |/ /_/ / / / /_/ / __/
/_/ |_|\__,_/_/ \__,_/_/
Apache Karaf (3.0.3)
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
karaf@root()>
karaf@root()>
karaf@root()>
karaf@root()> jaas:realm-list
Index | Realm Name | Login Module Class Name
-----------------------------------------------------------------------
1 | karaf | org.apache.karaf.jaas.modules.ldap.LDAPLoginModule
karaf@root()>
谢谢。
我想在 apache karaf 3.0.3 中激活 Ldap 登录模块。
我的 karaf-jaas-module.xml 是 ;
.
.
.
<jaas:config name="karaf" rank="2">
<jaas:module className="org.apache.karaf.jaas.modules.ldap.LDAPLoginModule" flags="required">
initialContextFactory=com.sun.jndi.ldap.LdapCtxFactory
connection.username=admin
connection.password=xxxxxxx
connection.protocol=
connection.url=ldap://activedirectory_host:389
user.base.dn=cn=orcladmin,cn=users,dc=vmldapdevelop,dc=com
user.filter=(sAMAccountName=%u)
user.search.subtree=true
role.base.dn=ou=Groups,ou=there,DC=local
role.name.attribute=cn
role.filter=(member=%nsdn)
role.search.subtree=true
authentication=simple
</jaas:module>
</jaas:config>
.
.
.
并且我在 karaf 控制台中写了 jaas:realm-list,但没有看到 LdapLoginModule。
karaf@root()> jaas:realm-list
Index | Realm Name | Login Module Class Name
----------------------------------------------------------------------------
1 | karaf | org.apache.karaf.jaas.modules.properties.PropertiesLoginModule
2 | karaf | org.apache.karaf.jaas.modules.publickey.PublickeyLoginModule
我该怎么做?
我怀疑 xml 可能在包中的错误位置。它应该像其他蓝图上下文一样在 OSGI-INF/blueprint 中。您还需要在蓝图 xml.
的 header 中具有正确的命名空间定义您可以通过执行 bundle:services 检查您的蓝图 xml 是否已处理。您应该会看到一个 BlueprintContainer 服务。如果不是,那么蓝图要么根本没有被拾取,要么扩展器发现错误。您可以使用 diag 命令显示蓝图错误。
是的,它在蓝图文件夹中。此文件夹位于 jaas_module 捆绑包中。但是在这个 xml 中改变任何东西,karaf 没有看到它。因为它覆盖了它。
我解决了我的问题。我创建了新的 xml 文件,名称为 ldap-module.xml 并且我的配置在其中。我把这个 xml 放在 deploy 文件夹中。
所以,我的新 xml 覆盖其他 xml,当我在 karaf 控制台上写 "jaas:realm-list" 时,我看到了这个输出;
__ __ ____
/ //_/____ __________ _/ __/
/ ,< / __ `/ ___/ __ `/ /_
/ /| |/ /_/ / / / /_/ / __/
/_/ |_|\__,_/_/ \__,_/_/
Apache Karaf (3.0.3)
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
karaf@root()>
karaf@root()>
karaf@root()>
karaf@root()> jaas:realm-list
Index | Realm Name | Login Module Class Name
-----------------------------------------------------------------------
1 | karaf | org.apache.karaf.jaas.modules.ldap.LDAPLoginModule
karaf@root()>
谢谢。