From 5388e107ac994650eb1623efb6c88d14d045e325 Mon Sep 17 00:00:00 2001 From: Son Dinh Date: Tue, 29 Nov 2016 13:32:00 +0000 Subject: [PATCH] token/jwt: Allow single element string arrays to be treated as strings This commit allows `aud` to be passed in as a single element array during consent validation on Hydra. This fixes https://github.com/ory-am/hydra/issues/314. Signed-off-by: Son Dinh --- token/jwt/claims.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/token/jwt/claims.go b/token/jwt/claims.go index b15ee2a7c..6e0513f19 100644 --- a/token/jwt/claims.go +++ b/token/jwt/claims.go @@ -19,6 +19,12 @@ func ToString(i interface{}) string { return s } + if sl, ok := i.([]string); ok { + if len(sl) == 1 { + return sl[0] + } + } + return "" }