From f016254377f606abde9297bf5ae1e80539fdef2a Mon Sep 17 00:00:00 2001 From: "Medina, Patrick J. D" Date: Sun, 4 Jul 2021 15:16:40 +0800 Subject: [PATCH] Added support for array of values in JWT claims during auto-subscription. --- lib/rig/subscriptions/parser/jwt.ex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/rig/subscriptions/parser/jwt.ex b/lib/rig/subscriptions/parser/jwt.ex index 33d31e16..7fcc7de2 100644 --- a/lib/rig/subscriptions/parser/jwt.ex +++ b/lib/rig/subscriptions/parser/jwt.ex @@ -52,6 +52,13 @@ defmodule RIG.Subscriptions.Parser.JWT do end |> Result.filter_and_unwrap() |> Enum.into(%{}) + |> Enum.map(fn {key, value} -> + cond do + is_list(value) -> Enum.map(value, fn element -> %{key => element} end) + is_bitstring(value) -> [%{key => value}] + end + end) + |> Enum.flat_map(& &1) |> List.wrap() end