HADOOP-17505. public interface GroupMappingServiceProvider needs default impl for getGroupsSet() (#2661). Contributed by Vinayakumar B.

This commit is contained in:
Vinayakumar B 2021-04-22 01:02:03 +05:30 committed by GitHub
parent 5221322b96
commit c4c0683dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.security;
import java.io.IOException;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@ -61,5 +62,8 @@ public interface GroupMappingServiceProvider {
* @return set of group memberships of user
* @throws IOException
*/
Set<String> getGroupsSet(String user) throws IOException;
default Set<String> getGroupsSet(String user) throws IOException {
//Override to form the set directly to avoid another conversion
return new LinkedHashSet<>(getGroups(user));
}
}