Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

<cleanthat.version>2.17</cleanthat.version>
<error-prone.version>2.24.1</error-prone.version>
<google-java-format.version>1.19.2</google-java-format.version>

<maven-clean-plugin.version>3.3.2</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
Expand Down
18 changes: 8 additions & 10 deletions src/main/java/tech/stackable/hadoop/StackableGroupMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@

public class StackableGroupMapper implements GroupMappingServiceProvider {

private static final Logger LOG = LoggerFactory.getLogger(StackableGroupMapper.class);

public static final String OPA_MAPPING_URL_PROP = "hadoop.security.group.mapping.opa.policy.url";
// response base field: see https://www.openpolicyagent.org/docs/latest/rest-api/#response-message
private static final String OPA_RESULT_FIELD = "result";

private static final Logger LOG = LoggerFactory.getLogger(StackableGroupMapper.class);
private final HttpClient httpClient = HttpClient.newHttpClient();
private final ObjectMapper json;
private URI opaUri;
Expand Down Expand Up @@ -59,12 +55,10 @@ public StackableGroupMapper() {
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
}

private static class OpaQueryResult {
public List<String> result;
}

/**
* Returns list of groups for a user.
* Returns list of groups for a user. Internally Hadoop will pass the short name to this function,
* but this prevents us from effectively separating users with the same names but with different
* kerberos principals.
*
* @param user get groups for this user
* @return list of groups for a given user
Expand Down Expand Up @@ -139,4 +133,8 @@ public void cacheGroupsAdd(List<String> groups) {
"ignoring cacheGroupsAdd for groups [{}]: caching should be provided by the policy provider",
groups);
}

private static class OpaQueryResult {
public List<String> result;
}
}