| | |
| | | package org.keycloak.protocol.cas.utils; |
| | | |
| | | import org.keycloak.protocol.cas.representations.CasServiceResponse; |
| | | import jakarta.xml.bind.JAXBElement; |
| | | import jakarta.xml.bind.annotation.XmlAccessType; |
| | | import jakarta.xml.bind.annotation.XmlAccessorType; |
| | | import jakarta.xml.bind.annotation.XmlAnyElement; |
| | | import jakarta.xml.bind.annotation.XmlSchema; |
| | | import jakarta.xml.bind.annotation.adapters.XmlAdapter; |
| | | import org.keycloak.protocol.cas.representations.CASServiceResponse; |
| | | |
| | | import javax.xml.bind.JAXBElement; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlAnyElement; |
| | | import javax.xml.bind.annotation.XmlSchema; |
| | | import javax.xml.bind.annotation.adapters.XmlAdapter; |
| | | import javax.xml.namespace.QName; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | AttributeWrapperType(Map<String, Object> attributes) { |
| | | this.elements = new ArrayList<>(); |
| | | for (Map.Entry<String, Object> entry : attributes.entrySet()) { |
| | | if (entry.getValue() instanceof List) { |
| | | for (Object item : ((List) entry.getValue())) { |
| | | if (entry.getValue() instanceof Collection) { |
| | | for (Object item : ((Collection<?>) entry.getValue())) { |
| | | addElement(entry.getKey(), item); |
| | | } |
| | | } else { |
| | |
| | | |
| | | private void addElement(String name, Object value) { |
| | | if (value != null) { |
| | | String namespace = CasServiceResponse.class.getPackage().getAnnotation(XmlSchema.class).namespace(); |
| | | String namespace = CASServiceResponse.class.getPackage().getAnnotation(XmlSchema.class).namespace(); |
| | | elements.add(new JAXBElement<>(new QName(namespace, name), String.class, value.toString())); |
| | | } |
| | | } |