feat: fix XML bug in GenerateCasToken()

This commit is contained in:
Yang Luo 2023-09-15 18:57:59 +08:00
parent 1276da4daa
commit ece060d03d

View File

@ -79,7 +79,7 @@ type CasUserAttributes struct {
type CasNamedAttribute struct { type CasNamedAttribute struct {
XMLName xml.Name `xml:"cas:attribute" json:"-"` XMLName xml.Name `xml:"cas:attribute" json:"-"`
Name string `xml:"name,attr,omitempty"` Name string `xml:"name,attr,omitempty"`
Value interface{} `xml:",innerxml"` Value string `xml:",innerxml"`
} }
type CasAnyAttribute struct { type CasAnyAttribute struct {
@ -219,7 +219,7 @@ func GenerateCasToken(userId string, service string) (string, error) {
if v != "" { if v != "" {
authenticationSuccess.Attributes.UserAttributes.Attributes = append(authenticationSuccess.Attributes.UserAttributes.Attributes, &CasNamedAttribute{ authenticationSuccess.Attributes.UserAttributes.Attributes = append(authenticationSuccess.Attributes.UserAttributes.Attributes, &CasNamedAttribute{
Name: k, Name: k,
Value: v, Value: fmt.Sprintf("%v", v),
}) })
} }
} }