Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RANGER-5064: checkstyle compliance updates - usersync - LdapUserGroupBuilder #506

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -438,36 +438,9 @@ private void setConfig() throws Throwable {
userSearchFilter = computedSearchFilter;
}

LOG.info("LdapUserGroupBuilder initialization completed with -- "
+ "ldapUrl: " + ldapUrl
+ ", ldapBindDn: " + ldapBindDn
+ ", ldapBindPassword: ***** "
+ ", ldapAuthenticationMechanism: " + ldapAuthenticationMechanism
+ ", searchBase: " + searchBase
+ ", userSearchBase: " + Arrays.toString(userSearchBase)
+ ", userSearchScope: " + userSearchScope
+ ", userObjectClass: " + userObjectClass
+ ", userSearchFilter: " + userSearchFilter
+ ", extendedUserSearchFilter: " + extendedUserSearchFilter
+ ", userNameAttribute: " + userNameAttribute
+ ", userSearchAttributes: " + userSearchAttributes
+ ", userGroupNameAttributeSet: " + userGroupNameAttributeSet
+ ", otherUserAttributes: " + otherUserAttributes
+ ", pagedResultsEnabled: " + pagedResultsEnabled
+ ", pagedResultsSize: " + pagedResultsSize
+ ", groupSearchEnabled: " + groupSearchEnabled
+ ", groupSearchBase: " + Arrays.toString(groupSearchBase)
+ ", groupSearchScope: " + groupSearchScope
+ ", groupObjectClass: " + groupObjectClass
+ ", groupSearchFilter: " + groupSearchFilter
+ ", extendedGroupSearchFilter: " + extendedGroupSearchFilter
+ ", extendedAllGroupsSearchFilter: " + extendedAllGroupsSearchFilter
+ ", groupMemberAttributeName: " + groupMemberAttributeName
+ ", groupNameAttribute: " + groupNameAttribute
+ ", groupSearchAttributes: " + groupSearchAttributes
+ ", groupSearchFirstEnabled: " + groupSearchFirstEnabled
+ ", userSearchEnabled: " + userSearchEnabled
+ ", ldapReferral: " + ldapReferral);
LOG.info("LdapUserGroupBuilder initialization completed with -- " +
"ldapUrl: {}, ldapBindDn: {}, ldapBindPassword: ***** , ldapAuthenticationMechanism: {}, searchBase: {}, userSearchBase: {}, userSearchScope: {}, userObjectClass: {}, userSearchFilter: {}, extendedUserSearchFilter: {}, userNameAttribute: {}, userSearchAttributes: {}, userGroupNameAttributeSet: {}, otherUserAttributes: {}, pagedResultsEnabled: {}, pagedResultsSize: {}, groupSearchEnabled: {}, groupSearchBase: {}, groupSearchScope: {}, groupObjectClass: {}, groupSearchFilter: {}, extendedGroupSearchFilter: {}, extendedAllGroupsSearchFilter: {}, groupMemberAttributeName: {}, groupNameAttribute: {}, groupSearchAttributes: {}, groupSearchFirstEnabled: {}, userSearchEnabled: {}, ldapReferral: {}",
ldapUrl, ldapBindDn, ldapAuthenticationMechanism, searchBase, Arrays.toString(userSearchBase), userSearchScope, userObjectClass, userSearchFilter, extendedUserSearchFilter, userNameAttribute, userSearchAttributes, userGroupNameAttributeSet, otherUserAttributes, pagedResultsEnabled, pagedResultsSize, groupSearchEnabled, Arrays.toString(groupSearchBase), groupSearchScope, groupObjectClass, groupSearchFilter, extendedGroupSearchFilter, extendedAllGroupsSearchFilter, groupMemberAttributeName, groupNameAttribute, groupSearchAttributes, groupSearchFirstEnabled, userSearchEnabled, ldapReferral);
}

private void closeLdapContext() throws Throwable {
Expand Down Expand Up @@ -1246,7 +1219,12 @@ private String getFirstRDN(String name) {
LdapName subjectDN = new LdapName(name);
List<Rdn> rdns = subjectDN.getRdns();

for (Rdn rdn : rdns) {
for (int i = rdns.size() - 1; i >= 0; i--) {
if (StringUtils.isNotEmpty(shortName)) {
break;
}

Rdn rdn = rdns.get(i);
Attributes attributes = rdn.toAttributes();

try {
Expand All @@ -1257,7 +1235,6 @@ private String getFirstRDN(String name) {

if (value != null) {
shortName = GROUP_NAME_ATTRIBUTE + value;
break;
}
}
} catch (NoSuchElementException ignore) {
Expand Down Expand Up @@ -1285,7 +1262,7 @@ private String getDNForMemberOf(String searchFilter) throws Throwable {
try {
createLdapContext();

SearchControls searchControls = new SearchControls();
SearchControls searchControls = new SearchControls();
Set<String> searchAttributes = new HashSet<>();
int total;

Expand Down