Interface LdapRoleMapper
-
- All Known Implementing Classes:
DefaultLdapRoleMapper
public interface LdapRoleMapper
will map ldap group to redback role- Since:
- 2.1
- Author:
- Olivier Lamy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<LdapGroup>getAllGroupObjects(DirContext context)Read all groups from LDAP and return the list of group objects.List<String>getAllGroups(DirContext context)read all groups from ldapList<String>getAllRoles(DirContext context)read all ldap groups then map to corresponding role (if no mapping found group is ignored)LdapGroupgetGroupForName(DirContext context, String groupName)List<LdapGroup>getGroupObjects(String username, DirContext context)List<String>getGroups(String username, DirContext context)StringgetGroupsDn()List<String>getGroupsMember(String group, DirContext context)StringgetLdapGroupClass()List<String>getRoles(String username, DirContext context, Collection<String> realRoles)StringgetUserIdAttribute()booleanhasRole(DirContext context, String role)booleanisUseDefaultRoleName()voidremoveAllRoles(DirContext context)voidremoveRole(String roleName, DirContext context)booleanremoveUserRole(String roleName, String username, DirContext context)booleansaveRole(String roleName, DirContext context)will save a ldap group corresponding to the mapping.booleansaveUserRole(String roleName, String username, DirContext context)associate role to user in ldap
-
-
-
Method Detail
-
getAllGroups
List<String> getAllGroups(DirContext context) throws MappingException
read all groups from ldap- Returns:
- all LDAP groups
- Throws:
MappingException
-
getAllGroupObjects
List<LdapGroup> getAllGroupObjects(DirContext context) throws MappingException
Read all groups from LDAP and return the list of group objects.- Returns:
- all LDAP groups found in the LDAP directory
- Throws:
MappingException
-
getGroupForName
LdapGroup getGroupForName(DirContext context, String groupName) throws MappingException
- Throws:
MappingException
-
getAllRoles
List<String> getAllRoles(DirContext context) throws MappingException
read all ldap groups then map to corresponding role (if no mapping found group is ignored)- Returns:
- all roles
- Throws:
MappingException
-
hasRole
boolean hasRole(DirContext context, String role) throws MappingException
- Throws:
MappingException
-
getGroupsDn
String getGroupsDn()
- Returns:
- the base dn which contains all ldap groups
-
getLdapGroupClass
String getLdapGroupClass()
- Returns:
- the class used for group usually groupOfUniqueNames
-
getGroupsMember
List<String> getGroupsMember(String group, DirContext context) throws MappingException
- Parameters:
group- ldap group- Returns:
- uids of group members
- Throws:
MappingException
-
getGroups
List<String> getGroups(String username, DirContext context) throws MappingException
- Throws:
MappingException
-
getGroupObjects
List<LdapGroup> getGroupObjects(String username, DirContext context) throws MappingException
- Throws:
MappingException
-
getRoles
List<String> getRoles(String username, DirContext context, Collection<String> realRoles) throws MappingException
- Throws:
MappingException
-
saveRole
boolean saveRole(String roleName, DirContext context) throws MappingException
will save a ldap group corresponding to the mapping. will do nothing in group already exists.- Parameters:
roleName-- Returns:
trueif role was added,falseif role already exists- Throws:
MappingException
-
saveUserRole
boolean saveUserRole(String roleName, String username, DirContext context) throws MappingException
associate role to user in ldap- Parameters:
roleName-username-- Returns:
trueif role was added to user,falseif role already exists for the user- Throws:
MappingException
-
removeUserRole
boolean removeUserRole(String roleName, String username, DirContext context) throws MappingException
- Throws:
MappingException
-
removeAllRoles
void removeAllRoles(DirContext context) throws MappingException
- Throws:
MappingException
-
removeRole
void removeRole(String roleName, DirContext context) throws MappingException
- Throws:
MappingException
-
getUserIdAttribute
String getUserIdAttribute()
-
isUseDefaultRoleName
boolean isUseDefaultRoleName()
-
-