return idx;
}
private InboundSecurityToken parseKeyInfo(InputProcessorChain inputProcessorChain, XMLSecurityProperties securityProperties,
Deque<XMLSecEvent> eventQueue, int index) throws XMLSecurityException {
XMLSecEvent xmlSecEvent = null;
int idx = 0;
Iterator<XMLSecEvent> xmlSecEventIterator = eventQueue.descendingIterator();
while (xmlSecEventIterator.hasNext() && idx <= index) {
xmlSecEvent = xmlSecEventIterator.next();
idx++;
}
//forward to next start element
while (xmlSecEventIterator.hasNext()) {
xmlSecEvent = xmlSecEventIterator.next();
if (xmlSecEvent.isStartElement()) {
break;
}
idx++;
}
if (xmlSecEvent == null || !xmlSecEvent.isStartElement()) {
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, "noKeyInSAMLToken");
}
final XMLSecStartElement xmlSecStartElement = xmlSecEvent.asStartElement();
final QName elementName = xmlSecStartElement.getName();
if (WSSConstants.TAG_wst_BinarySecret.equals(elementName) ||
WSSConstants.TAG_wst0512_BinarySecret.equals(elementName)) {
final StringBuilder stringBuilder = new StringBuilder();
loop:
while (xmlSecEventIterator.hasNext()) {
xmlSecEvent = xmlSecEventIterator.next();
switch (xmlSecEvent.getEventType()) {
case XMLStreamConstants.END_ELEMENT:
if (xmlSecEvent.asEndElement().getName().equals(elementName)) {
break loop;
}
break;
case XMLStreamConstants.CHARACTERS:
stringBuilder.append(xmlSecEvent.asCharacters().getText());
break;
}
}
return new AbstractInboundSecurityToken(