clintropolis commented on a change in pull request #10896:
URL: https://github.com/apache/druid/pull/10896#discussion_r580912940
##########
File path:
extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/entity/BasicAuthorizerRole.java
##########
@@ -78,4 +90,35 @@ public int hashCode()
result = 31 * result + (getPermissions() != null ?
getPermissions().hashCode() : 0);
return result;
}
+
+
+ static class PermissionsDeserializer extends
JsonDeserializer<List<BasicAuthorizerPermission>>
+ {
+ @Override
+ public List<BasicAuthorizerPermission> deserialize(
+ JsonParser jsonParser,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ List<BasicAuthorizerPermission> permissions = new ArrayList<>();
+ // sanity check
+ ObjectCodec codec = jsonParser.getCodec();
+ JsonNode hopefullyAnArray = codec.readTree(jsonParser);
+ if (!hopefullyAnArray.isArray()) {
+ throw new RE("Failed to deserialize authorizer role list");
+ }
+
+ for (JsonNode node : hopefullyAnArray) {
+ try {
+ permissions.add(codec.treeToValue(node,
BasicAuthorizerPermission.class));
+ }
+ catch (JsonProcessingException e) {
+ // ignore unparseable, it might be resource types we don't know about
+ log.warn(e, "Failed to deserialize authorizer role, ignoring");
Review comment:
:+1:, added
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]