From 0616b32f9e8c1b912a51a5de0d67edc23b34f31c Mon Sep 17 00:00:00 2001 From: ivanjunckes Date: Thu, 2 Aug 2018 11:55:26 -0300 Subject: [PATCH] adding enum conversion --- .../org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java index be83a9b3890..f36405b4fc9 100644 --- a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java +++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java @@ -256,6 +256,11 @@ public Object get() { // handle JsonValue (number, string, etc) return (T) toJson(key); + } else if (((Class) ip.getType()).isEnum()) { + try { + return (T) ((Class) ip.getType()).getMethod("valueOf", String.class).invoke(null, getClaimValue(key).toString()); + } catch (Exception e) { + } } else { // handle Raw types return getClaimValue(key);