SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
IssuedToken issuedToken = new IssuedToken(consts);
issuedToken.setOptional(PolicyConstants.isOptional(element));
issuedToken.setIgnorable(PolicyConstants.isIgnorable(element));
String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken());
if (includeAttr != null) {
issuedToken.setInclusion(consts.getInclusionFromAttributeValue(includeAttr));
}
Element child = DOMUtils.getFirstElement(element);
while (child != null) {
String ln = child.getLocalName();
if (SP11Constants.ISSUER.getLocalPart().equals(ln)) {
Element issuerEpr = DOMUtils
.getFirstChildWithName(child,
new QName(WSA_NAMESPACE, "Address"));
// try the other addressing namespace
if (issuerEpr == null) {
issuerEpr = DOMUtils
.getFirstChildWithName(child,
new QName(WSA_NAMESPACE_SUB,
"Address"));
}
issuedToken.setIssuerEpr(issuerEpr);
Element issuerMex = DOMUtils
.getFirstChildWithName(child,
new QName(WSA_NAMESPACE, "Metadata"));
// try the other addressing namespace
if (issuerMex == null) {
issuerMex = DOMUtils
.getFirstChildWithName(child,
new QName(WSA_NAMESPACE_SUB,
"Metadata"));
}
issuedToken.setIssuerMex(issuerMex);
} else if (SPConstants.REQUEST_SECURITY_TOKEN_TEMPLATE.equals(ln)) {
issuedToken.setRstTemplate(child);
} else if (org.apache.neethi.Constants.ELEM_POLICY.equals(ln)) {
Policy policy = builder.getPolicy(child);
policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);
for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {