public final class LdapSearch extends Object implements DirSearch
Constructor and Description |
---|
LdapSearch(HiveConf conf,
DirContext ctx)
Construct an instance of
LdapSearch . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this search object and releases any system resources associated
with it.
|
List<String> |
executeCustomQuery(String query)
Executes an arbitrary query.
|
String |
findGroupDn(String group)
Finds group's distinguished name.
|
List<String> |
findGroupsForUser(String userDn)
Finds groups that contain the specified user.
|
String |
findUserDn(String user)
Finds user's distinguished name.
|
boolean |
isUserMemberOfGroup(String user,
String groupDn)
Verifies that specified user is a member of specified group.
|
public LdapSearch(HiveConf conf, DirContext ctx) throws NamingException
LdapSearch
.conf
- Hive configurationctx
- Directory service that will be used for the queries.NamingException
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public String findUserDn(String user) throws NamingException
findUserDn
in interface DirSearch
user
- usernameNamingException
public String findGroupDn(String group) throws NamingException
findGroupDn
in interface DirSearch
group
- group name or unique identifierNamingException
public boolean isUserMemberOfGroup(String user, String groupDn) throws NamingException
isUserMemberOfGroup
in interface DirSearch
user
- user id or distinguished namegroupDn
- group's DNtrue
if the user is a member of the group, false
- otherwise.NamingException
public List<String> findGroupsForUser(String userDn) throws NamingException
findGroupsForUser
in interface DirSearch
userDn
- user's distinguished nameNamingException
public List<String> executeCustomQuery(String query) throws NamingException
executeCustomQuery
in interface DirSearch
query
- any queryNamingException
Copyright © 2021 The Apache Software Foundation. All rights reserved.