From ce7a2e924bb2b0fac34ac8ccb4d016603ea6642d Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Fri, 15 Sep 2023 22:38:04 +0800 Subject: [PATCH] feat: fix XML format issue in GenerateCasToken() --- object/token_cas.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/object/token_cas.go b/object/token_cas.go index 384ec71c..ea39dceb 100644 --- a/object/token_cas.go +++ b/object/token_cas.go @@ -216,10 +216,15 @@ func GenerateCasToken(userId string, service string) (string, error) { } for k, v := range tmp { + value := fmt.Sprintf("%v", v) + if value == "" || value == "[]" || value == "map[]" { + value = "" + } + if v != "" { authenticationSuccess.Attributes.UserAttributes.Attributes = append(authenticationSuccess.Attributes.UserAttributes.Attributes, &CasNamedAttribute{ Name: k, - Value: fmt.Sprintf("%v", v), + Value: value, }) } }