|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.james.user.ldap.ReadOnlyUsersLDAPRepository
public class ReadOnlyUsersLDAPRepository
This repository implementation serves as a bridge between Apache James and LDAP. It allows James to authenticate users against an LDAP compliant server such as Apache DS or Microsoft AD. It also enables role/group based access restriction based on LDAP groups.
It is intended for organisations that already have a user-authentication and authorisation mechanism in place, and want to leverage this when deploying James. The assumption inherent here is that such organisations would not want to manage user details via James, but will do so externally using whatever mechanism provided by, or built on top off, their LDAP implementation.
Based on this assumption, this repository is strictly read-only. As a consequence, user modification, deletion and creation requests will be ignored when using this repository.
The following fragment of XML provides an example configuration to enable this repository:
<users-store>
<repository name="LDAPUsers"
class="org.apache.james.userrepository.ReadOnlyUsersLDAPRepository"
ldapHost="ldap://myldapserver:389"
principal="uid=ldapUser,ou=system"
credentials="password"
userBase="ou=People,o=myorg.com,ou=system"
userIdAttribute="uid"/>
userObjectClass="inetOrgPerson"/>
</users-store>
Its constituent attributes are defined as follows:
In order to enable group/role based access restrictions, you can use the
"<restriction>" configuration element. An example of this is
shown below:
<restriction
memberAttribute="uniqueMember">
<group>cn=PermanentStaff,ou=Groups,o=myorg.co.uk,ou=system</group>
<group>cn=TemporaryStaff,ou=Groups,o=myorg.co.uk,ou=system</group>
</restriction>
SimpleLDAPConnection,
ReadOnlyLDAPUser,
ReadOnlyLDAPGroupRestriction| Field Summary |
|---|
| Fields inherited from interface org.apache.james.user.api.UsersRepository |
|---|
ROLE, USER |
| Constructor Summary | |
|---|---|
ReadOnlyUsersLDAPRepository()
|
|
| Method Summary | |
|---|---|
void |
addUser(java.lang.String name,
java.lang.Object attributes)
|
boolean |
addUser(java.lang.String username,
java.lang.String password)
|
boolean |
addUser(User user)
|
void |
configure(org.apache.commons.configuration.HierarchicalConfiguration configuration)
Extracts the parameters required by the repository instance from the James server configuration data. |
boolean |
contains(java.lang.String name)
|
boolean |
containsCaseInsensitive(java.lang.String name)
|
int |
countUsers()
|
java.lang.String |
getRealName(java.lang.String name)
|
User |
getUserByName(java.lang.String name)
|
User |
getUserByNameCaseInsensitive(java.lang.String name)
|
void |
init()
Initialises the user-repository instance. |
java.util.Iterator<java.lang.String> |
list()
|
void |
removeUser(java.lang.String name)
|
void |
setLog(org.apache.commons.logging.Log log)
|
boolean |
test(java.lang.String name,
java.lang.String password)
|
boolean |
updateUser(User user)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReadOnlyUsersLDAPRepository()
| Method Detail |
|---|
public void configure(org.apache.commons.configuration.HierarchicalConfiguration configuration)
throws org.apache.commons.configuration.ConfigurationException
Extracts the parameters required by the repository instance from the
James server configuration data. The fields extracted include
ldapHost, userIdAttribute, userBase,
principal, credentials and restriction.
configure in interface Configurableconfiguration - An encapsulation of the James server configuration data.
org.apache.commons.configuration.ConfigurationException
@PostConstruct
public void init()
throws java.lang.Exception
Initialises the user-repository instance. It will create a connection to the LDAP host using the supplied configuration.
java.lang.Exception - If an error occurs authenticating or connecting to the
specified LDAP host.public boolean contains(java.lang.String name)
contains in interface UsersRepositorypublic boolean containsCaseInsensitive(java.lang.String name)
containsCaseInsensitive in interface UsersRepositorypublic int countUsers()
countUsers in interface UsersRepositorypublic java.lang.String getRealName(java.lang.String name)
getRealName in interface UsersRepositorypublic User getUserByName(java.lang.String name)
getUserByName in interface UsersRepositorypublic User getUserByNameCaseInsensitive(java.lang.String name)
getUserByNameCaseInsensitive in interface UsersRepositorypublic java.util.Iterator<java.lang.String> list()
list in interface UsersRepositorypublic void removeUser(java.lang.String name)
removeUser in interface UsersRepository
public boolean test(java.lang.String name,
java.lang.String password)
test in interface UsersRepositorypublic boolean addUser(User user)
addUser in interface UsersRepository
public void addUser(java.lang.String name,
java.lang.Object attributes)
addUser in interface UsersRepository
public boolean addUser(java.lang.String username,
java.lang.String password)
addUser in interface UsersRepositorypublic boolean updateUser(User user)
updateUser in interface UsersRepositorypublic void setLog(org.apache.commons.logging.Log log)
setLog in interface LogEnabled
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||