CASC-134
change to get Attributes instead of just getAttribute in case there are multiple values.
This commit is contained in:
parent
befd53e456
commit
4a36b023a6
|
|
@ -77,7 +77,7 @@ public final class XmlUtils {
|
|||
|
||||
private boolean foundElement = false;
|
||||
|
||||
private StringBuffer buffer = new StringBuffer();
|
||||
private StringBuilder buffer = new StringBuilder();
|
||||
|
||||
public void startElement(final String uri, final String localName,
|
||||
final String qName, final Attributes attributes)
|
||||
|
|
@ -92,7 +92,7 @@ public final class XmlUtils {
|
|||
if (localName.equals(element)) {
|
||||
this.foundElement = false;
|
||||
elements.add(this.buffer.toString());
|
||||
this.buffer = new StringBuffer();
|
||||
this.buffer = new StringBuilder();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,13 @@ public class Cas20ServiceTicketValidator extends AbstractCasProtocolUrlBasedTick
|
|||
}
|
||||
|
||||
for (final String name : attributeNames) {
|
||||
attributes.put(name, XmlUtils.getTextForElement(xml, name));
|
||||
final List<String> values = XmlUtils.getTextForElements(xml, name);
|
||||
|
||||
if (values.size() == 1) {
|
||||
attributes.put(name, values.get(0));
|
||||
} else {
|
||||
attributes.put(name, values);
|
||||
}
|
||||
}
|
||||
|
||||
return attributes;
|
||||
|
|
|
|||
|
|
@ -97,8 +97,7 @@ public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator
|
|||
|
||||
final SAMLAttribute[] attributes = getAttributesFor(assertion, subject);
|
||||
final Map<String,Object> personAttributes = new HashMap<String,Object>();
|
||||
for (int i = 0; i < attributes.length; i++) {
|
||||
final SAMLAttribute samlAttribute = attributes[i];
|
||||
for (final SAMLAttribute samlAttribute : attributes) {
|
||||
final List<?> values = getValuesFrom(samlAttribute);
|
||||
|
||||
personAttributes.put(samlAttribute.getName(), values.size() == 1 ? values.get(0) : values);
|
||||
|
|
@ -212,16 +211,14 @@ public final class Saml11TicketValidator extends AbstractUrlBasedTicketValidator
|
|||
out.close();
|
||||
|
||||
final BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
final StringBuffer buffer = new StringBuffer(256);
|
||||
final StringBuilder buffer = new StringBuilder(256);
|
||||
|
||||
synchronized (buffer) {
|
||||
String line;
|
||||
String line;
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
buffer.append(line);
|
||||
}
|
||||
return buffer.toString();
|
||||
while ((line = in.readLine()) != null) {
|
||||
buffer.append(line);
|
||||
}
|
||||
return buffer.toString();
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Reference in New Issue