You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/02/23 10:14:51 UTC
[GitHub] [druid] clintropolis commented on a change in pull request #10896: basic security extension ignore permissions that use unknown ResourceType or Action
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org