}
public Assertion build(Element element, AssertionBuilderFactory factory)
throws IllegalArgumentException {
SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
SecurityContextToken contextToken = new SecurityContextToken(consts);
String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken());
if (includeAttr != null) {
contextToken.setInclusion(consts.getInclusionFromAttributeValue(includeAttr));
}
element = PolicyConstants.findPolicyElement(element);
if (element != null) {
if (DOMUtils.getFirstChildWithName(element,
consts.getNamespace(),
SPConstants.REQUIRE_DERIVED_KEYS) != null) {
contextToken.setDerivedKeys(true);
}
if (DOMUtils.getFirstChildWithName(element,
consts.getNamespace(),
SPConstants.REQUIRE_EXTERNAL_URI_REFERENCE) != null) {
contextToken.setRequireExternalUriRef(true);
}
if (DOMUtils.getFirstChildWithName(element,
consts.getNamespace(),
SPConstants.SC10_SECURITY_CONTEXT_TOKEN) != null) {
contextToken.setSc10SecurityContextToken(true);
}
}