@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { roles.addAll( LDAPUtils.getLdapTemplateInContext(ctx, template) .searchForSingleAttributeValues( groupSearchBase, groupNameFilter, new String[] {roleName}, groupNameAttribute)); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { DirContextOperations obj = (DirContextOperations) LDAPUtils.getLdapTemplateInContext(ctx, template) .lookup(user); String name = obj.getObjectAttribute(userNameAttribute).toString(); Matcher m = userNamePattern.matcher(name); if (m.matches()) { name = m.group(1); } userName.set(name); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { LDAPUtils.getLdapTemplateInContext(ctx, template) .search(userSearchBase, propname + "=*", addToUsers(users)); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { try { dn.set( LDAPUtils.getLdapTemplateInContext(ctx, template) .searchForSingleEntry( "", userNameFilter, new String[] {username}) .getDn() .toString()); } catch (Exception e) { // not found, let's use username instead } } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { Set<String> groupNames = LDAPUtils.getLdapTemplateInContext(ctx, template) .searchForSingleAttributeValues( groupSearchBase, allGroupsSearchFilter, new String[] {}, groupNameAttribute); for (String groupName : groupNames) { groups.add(new GeoServerUserGroup(groupName)); } } });
private void fillAllRoles(DirContext ctx, SortedSet<GeoServerRole> roles) { Set<String> roleNames = LDAPUtils.getLdapTemplateInContext(ctx, template) .searchForSingleAttributeValues( groupSearchBase, allGroupsSearchFilter, new String[] {}, groupNameAttribute); addRolesToSet(roles, roleNames); }
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { LDAPUtils.getLdapTemplateInContext(ctx, template) .search(groupSearchBase, allGroupsSearchFilter, counter(count)); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { LDAPUtils.getLdapTemplateInContext(ctx, template) .search( userSearchBase, "(&(!(" + propname + "=*))(" + allUsersSearchFilter + "))", counter(size)); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { LDAPUtils.getLdapTemplateInContext(ctx, template) .search(groupSearchBase, allGroupsSearchFilter, counter(size)); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { LDAPUtils.getLdapTemplateInContext(ctx, template) .search( userSearchBase, "(&(!(" + propname + "=*))(" + allUsersSearchFilter + "))", addToUsers(users)); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { LDAPUtils.getLdapTemplateInContext(ctx, template) .search( userSearchBase, propname + "=" + propvalue, addToUsers(users)); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { LDAPUtils.getLdapTemplateInContext(ctx, template) .search(userSearchBase, propname + "=" + propvalue, counter(size)); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { LDAPUtils.getLdapTemplateInContext(ctx, template) .search(userSearchBase, propname + "=*", counter(size)); } });
private void fillRolesForUser( DirContext ctx, String username, String userDn, SortedSet<GeoServerRole> roles) { Set<String> roleNames = LDAPUtils.getLdapTemplateInContext(ctx, template) .searchForSingleAttributeValues( groupSearchBase, groupMembershipFilter, new String[] {username, userDn}, groupNameAttribute); addRolesToSet(roles, roleNames); }
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { LDAPUtils.getLdapTemplateInContext(ctx, template) .search(userSearchBase, allUsersSearchFilter, addToUsers(users)); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { LDAPUtils.getLdapTemplateInContext(ctx, template) .search(userSearchBase, allUsersSearchFilter, counter(size)); } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { try { DirContextOperations dco = LDAPUtils.getLdapTemplateInContext(ctx, template) .searchForSingleEntry( userSearchBase, userNameFilter, new String[] {username}); if (dco != null) { user.set(createUser(dco)); } } catch (IncorrectResultSizeDataAccessException e) { } } });
private void fillUsersForRole(DirContext ctx, SortedSet<String> users, GeoServerRole role) { String roleStr = role.toString(); if (roleStr.startsWith("ROLE_")) { // remove standard role prefix roleStr = roleStr.substring(5); } DirContextOperations roleObj = LDAPUtils.getLdapTemplateInContext(ctx, template) .searchForSingleEntry( groupSearchBase, groupNameFilter, new String[] {roleStr}); if (roleObj != null) { Object[] usernames = roleObj.getObjectAttributes(groupMembershipAttribute); if (usernames != null) { for (Object username : usernames) { String user = username.toString(); Matcher m = userMembershipPattern.matcher(user); if (m.matches()) { user = m.group(1); } users.add(getUserNameFromMembership(user)); } } } }
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { try { DirContextOperations dco = LDAPUtils.getLdapTemplateInContext(ctx, template) .searchForSingleEntry( groupSearchBase, groupNameFilter, new String[] {groupname}); if (dco != null) { group.set( new GeoServerUserGroup( dco.getStringAttribute(groupNameAttribute))); } } catch (IncorrectResultSizeDataAccessException e) { } } });
@Override public void executeWithContext( DirContext ctx, LdapEntryIdentification ldapEntryIdentification) { Set<String> groupNames = LDAPUtils.getLdapTemplateInContext(ctx, template) .searchForSingleAttributeValues( groupSearchBase, groupMembershipFilter, new String[] { user.getUsername(), lookupDn(user.getUsername()) }, groupNameAttribute); for (String groupName : groupNames) { groups.add(new GeoServerUserGroup(groupName)); } } });