use of org.apache.shiro.realm.ldap.DefaultLdapRealm in project zeppelin by apache.
the class ShiroAuthenticationService method getMatchedUsers.
/**
* Get candidated users based on searchText
*
* @param searchText
* @param numUsersToFetch
* @return
*/
@Override
public List<String> getMatchedUsers(String searchText, int numUsersToFetch) {
List<String> usersList = new ArrayList<>();
try {
Collection<Realm> realmsList = getRealmsList();
if (realmsList != null) {
for (Realm realm : realmsList) {
String realClassName = realm.getClass().getName();
LOGGER.debug("RealmClass.getName: {}", realClassName);
if (INI_REALM.equals(realClassName)) {
usersList.addAll(getUserList((IniRealm) realm));
} else if (LDAP_GROUP_REALM.equals(realClassName)) {
usersList.addAll(getUserList((DefaultLdapRealm) realm, searchText, numUsersToFetch));
} else if (LDAP_REALM.equals(realClassName)) {
usersList.addAll(getUserList((LdapRealm) realm, searchText, numUsersToFetch));
} else if (ACTIVE_DIRECTORY_GROUP_REALM.equals(realClassName)) {
usersList.addAll(getUserList((ActiveDirectoryGroupRealm) realm, searchText, numUsersToFetch));
} else if (JDBC_REALM.equals(realClassName)) {
usersList.addAll(getUserList((JdbcRealm) realm));
}
}
}
} catch (Exception e) {
LOGGER.error("Exception in retrieving Users from realms ", e);
}
return usersList;
}
Aggregations