NIFI-655:

- Adding support for specifying the user search base and user search filter in the active directory provider.
This commit is contained in:
Matt Gilman 2015-11-12 21:37:55 -05:00
parent 6f82802f7a
commit 09cb608859
1 changed files with 13 additions and 8 deletions

View File

@ -29,18 +29,23 @@ public class ActiveDirectoryProvider extends AbstractLdapProvider {
@Override
protected AbstractLdapAuthenticationProvider getLdapAuthenticationProvider(LoginIdentityProviderConfigurationContext configurationContext) throws ProviderCreationException {
final String domain = configurationContext.getProperty("Domain");
if (StringUtils.isBlank(domain)) {
throw new ProviderCreationException("The Active Directory Domain must be specified.");
}
final String url = configurationContext.getProperty("Url");
if (StringUtils.isBlank(url)) {
throw new ProviderCreationException("The Active Directory Url must be specified.");
throw new ProviderCreationException("The Active Directory 'Url' must be specified.");
}
final String rootDn = configurationContext.getProperty("Root DN");
final String domain = configurationContext.getProperty("Domain");
final String userSearchBase = configurationContext.getProperty("User Search Base");
return new ActiveDirectoryLdapAuthenticationProvider(domain, url, StringUtils.isBlank(rootDn) ? null : rootDn);
final ActiveDirectoryLdapAuthenticationProvider activeDirectoryAuthenticationProvider =
new ActiveDirectoryLdapAuthenticationProvider(StringUtils.isBlank(domain) ? null : domain, url, StringUtils.isBlank(userSearchBase) ? null : userSearchBase);
final String userSearchFilter = configurationContext.getProperty("User Search Filter");
if (StringUtils.isNotBlank(userSearchFilter)) {
activeDirectoryAuthenticationProvider.setSearchFilter(userSearchFilter);
}
return activeDirectoryAuthenticationProvider;
}
}