Package org.codelibs.fess.ldap
Class LdapManager
- java.lang.Object
-
- org.codelibs.fess.ldap.LdapManager
-
public class LdapManager extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classLdapManager.DirContextHolder
-
Field Summary
Fields Modifier and Type Field Description protected ThreadLocal<LdapManager.DirContextHolder>contextLocalprotected FessConfigfessConfigprotected booleanisBind
-
Constructor Summary
Constructors Constructor Description LdapManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddGroupAttributes(BasicAttributes entry, Group group)protected voidaddRoleAttributes(BasicAttributes entry, Role user)protected voidaddUserAttributes(BasicAttributes entry, User user)voidapply(Group group)voidapply(User user)booleanchangePassword(String username, String password)protected Hashtable<String,String>createAdminEnv()protected Hashtable<String,String>createEnvironment(String initialContextFactory, String securityAuthentication, String providerUrl, String principal, String credntials)protected LdapUsercreateLdapUser(String username, Hashtable<String,String> env)protected Hashtable<String,String>createSearchEnv()protected Hashtable<String,String>createSearchEnv(String username, String password)protected voiddelete(String entryDN, Supplier<Hashtable<String,String>> envSupplier)voiddelete(Group group)voiddelete(Role role)voiddelete(User user)protected List<Object>getAttributeValueList(List<SearchResult> result, String name)protected LdapManager.DirContextHoldergetDirContext(Supplier<Hashtable<String,String>> envSupplier)String[]getRoles(LdapUser ldapUser, String bindDn, String accountFilter, String groupFilter, Consumer<String[]> lazyLoading)protected StringgetSearchRoleName(String entryDn)voidinit()protected voidinsert(String entryDN, Attributes entry, Supplier<Hashtable<String,String>> envSupplier)voidinsert(Group group)voidinsert(Role role)voidinsert(User user)org.dbflute.optional.OptionalEntity<FessUser>login(String username)org.dbflute.optional.OptionalEntity<FessUser>login(String username, String password)protected voidmodify(String dn, List<ModificationItem> modifyList, Supplier<Hashtable<String,String>> envSupplier)protected voidmodifyAddEntry(List<ModificationItem> modifyList, String name, String value)protected voidmodifyDeleteEntry(List<ModificationItem> modifyList, String name, Object value)protected voidmodifyGroupAttributes(Group group, Supplier<Hashtable<String,String>> adminEnv, String entryDN, List<SearchResult> result)protected voidmodifyReplaceEntry(List<ModificationItem> modifyList, String name, String value)protected voidmodifyUserAttributes(User user, Supplier<Hashtable<String,String>> adminEnv, String userDN, List<SearchResult> result)StringnormalizePermissionName(String name)protected voidprocessSearchRoles(List<SearchResult> result, BiConsumer<String,String> consumer)protected voidprocessSearchRoles(List<SearchResult> result, Consumer<String> consumer)protected voidprocessSubRoles(LdapUser ldapUser, String bindDn, Set<String> subRoleSet, String groupFilter, Set<String> roleSet)protected voidputEnv(Hashtable<String,String> env, String key, String value)protected StringreplaceWithUnderscores(String value)protected voidsearch(String baseDn, String filter, String[] returningAttrs, Supplier<Hashtable<String,String>> envSupplier, org.codelibs.fess.ldap.LdapManager.SearchConsumer consumer)protected voidsetAttributeValue(List<SearchResult> result, String name, Consumer<Object> consumer)voidupdateConfig()protected voidupdateSearchRoles(Set<String> roleSet, String entryDn)protected booleanvalidate()voidvalidateGroupAttributes(Class<?> type, Map<String,String> attributes, Consumer<String> consumer)voidvalidateUserAttributes(Class<?> type, Map<String,String> attributes, Consumer<String> consumer)
-
-
-
Field Detail
-
contextLocal
protected ThreadLocal<LdapManager.DirContextHolder> contextLocal
-
isBind
protected volatile boolean isBind
-
fessConfig
protected FessConfig fessConfig
-
-
Method Detail
-
init
@PostConstruct public void init()
-
createEnvironment
protected Hashtable<String,String> createEnvironment(String initialContextFactory, String securityAuthentication, String providerUrl, String principal, String credntials)
-
createSearchEnv
protected Hashtable<String,String> createSearchEnv(String username, String password)
-
updateConfig
public void updateConfig()
-
validate
protected boolean validate()
-
getRoles
public String[] getRoles(LdapUser ldapUser, String bindDn, String accountFilter, String groupFilter, Consumer<String[]> lazyLoading)
-
processSubRoles
protected void processSubRoles(LdapUser ldapUser, String bindDn, Set<String> subRoleSet, String groupFilter, Set<String> roleSet)
-
processSearchRoles
protected void processSearchRoles(List<SearchResult> result, BiConsumer<String,String> consumer) throws NamingException
- Throws:
NamingException
-
processSearchRoles
protected void processSearchRoles(List<SearchResult> result, Consumer<String> consumer) throws NamingException
- Throws:
NamingException
-
setAttributeValue
protected void setAttributeValue(List<SearchResult> result, String name, Consumer<Object> consumer)
-
getAttributeValueList
protected List<Object> getAttributeValueList(List<SearchResult> result, String name)
-
apply
public void apply(User user)
-
insert
public void insert(User user)
-
modifyUserAttributes
protected void modifyUserAttributes(User user, Supplier<Hashtable<String,String>> adminEnv, String userDN, List<SearchResult> result)
-
addUserAttributes
protected void addUserAttributes(BasicAttributes entry, User user)
-
validateUserAttributes
public void validateUserAttributes(Class<?> type, Map<String,String> attributes, Consumer<String> consumer)
-
delete
public void delete(User user)
-
insert
public void insert(Role role)
-
addRoleAttributes
protected void addRoleAttributes(BasicAttributes entry, Role user)
-
delete
public void delete(Role role)
-
apply
public void apply(Group group)
-
insert
public void insert(Group group)
-
modifyGroupAttributes
protected void modifyGroupAttributes(Group group, Supplier<Hashtable<String,String>> adminEnv, String entryDN, List<SearchResult> result)
-
addGroupAttributes
protected void addGroupAttributes(BasicAttributes entry, Group group)
-
validateGroupAttributes
public void validateGroupAttributes(Class<?> type, Map<String,String> attributes, Consumer<String> consumer)
-
delete
public void delete(Group group)
-
insert
protected void insert(String entryDN, Attributes entry, Supplier<Hashtable<String,String>> envSupplier)
-
search
protected void search(String baseDn, String filter, String[] returningAttrs, Supplier<Hashtable<String,String>> envSupplier, org.codelibs.fess.ldap.LdapManager.SearchConsumer consumer)
-
modifyAddEntry
protected void modifyAddEntry(List<ModificationItem> modifyList, String name, String value)
-
modifyReplaceEntry
protected void modifyReplaceEntry(List<ModificationItem> modifyList, String name, String value)
-
modifyDeleteEntry
protected void modifyDeleteEntry(List<ModificationItem> modifyList, String name, Object value)
-
modify
protected void modify(String dn, List<ModificationItem> modifyList, Supplier<Hashtable<String,String>> envSupplier)
-
getDirContext
protected LdapManager.DirContextHolder getDirContext(Supplier<Hashtable<String,String>> envSupplier)
-
-