使用Apache James Mail服务器和LDAP

在我的LDAP服务器(ApacheDS)

我有ou=users,ou=system users下的ou=users,ou=system

我将下面的configuration写入James,并且两台服务器都可以启动(DS和James)。

 <repository name="LocalUsers" class="org.apache.james.user.ldap.ReadOnlyUsersLDAPRepository" ldapHost="ldap://localhost:10389" principal="uid=admin,ou=system" credentials="secret" userBase="ou=users,ou=system" userIdAttribute="uid"/> 

我知道我的configuration是好的,因为我收到警告“用户存储库是只读”,当我尝试通过james-cli.sh添加用户

我将一些用户直接添加到LDAP服务器,他们有DNCNuid

我想问,我怎么能通过詹姆斯(邮件服务器)login到我的用户帐户在LDAP服务器? 我该怎么写blah @ blah。 我想我可以使用uid作为第一个等等,但是我不能通过James定义域,因为它的LDAP门是只读的。

validationJAMESWİTHLDAP的步骤(此例为ApacheDS)

在James的conf / usersrepository.xml中删除有关JPA的logging

并添加下面的行,最后一个必须是这样的:

 <xml> <repository name="LocalUsers" class="org.apache.james.user.ldap.ReadOnlyUsersLDAPRepository" ldapHost="ldap://localhost:10389" principal="uid=admin,ou=system" credentials="secret" userObjectClass="inetOrgPerson" userBase="ou=users,ou=system" userIdAttribute="uid"> <UsersDomain>example.com</UsersDomain> <LDAPRoot>dc=example,dc=com</LDAPRoot> <MailAddressAttribute>mail</MailAddressAttribute> <IdentityAttribute>uid</IdentityAttribute> <AuthenticationType>simple</AuthenticationType> <ManagePasswordAttribute>TRUE</ManagePasswordAttribute> <PasswordAttribute>userPassword</PasswordAttribute> </repository> </xml> 

稍微解释一下;

在ApacheDS的默认构造中,有一个具有“dc = example,dc = com”

因此,应该添加行:

 <UsersDomain>example.com</UsersDomain> <LDAPRoot>dc=example,dc=com</LDAPRoot> 

并且应该为James添加一个名为“example.com”的域名,它保存了关于仍在JPA中的域名的信息。

${james_root}/container-spring/target/appassembler/bin/james-cli.sh -h localhost adddomain example.com

ApacheDS的pipe理员是“ou = system”项下的pipe理员,其默认密码是“secret”,因此我们需要以下属性:

 principal="uid=admin,ou=system" credentials="secret" 

在ApacheDS中,当你想添加一个条目需要对象类的时候,应该select“inetOrgPerson”,并且它会自动添加一些属性,

 userObjectClass="inetOrgPerson" 

用户正在input“ou = users,ou = system”,因此应该添加属性:

 userBase="ou=users,ou=system" 

对于ApacheDS,userIdAttribute是“uid”,因此指定:

 userIdAttribute="uid" 

在ApacheDS中,新用户应添加在"ou=users,ou=system" ,并带有"uid""userPassword"属性。 在添加新用户的同时,DN应该包含"uid"

当用例如POP3来查询James时,

 USER [email protected] PASS yourUsersPassword 

应该使用。