use of com.sun.identity.saml2.assertion.AssertionFactory in project OpenAM by OpenRock.
the class LogoutResponseImpl method parseElement.
/**
* Parses the Docuemnt Element for this object.
*
* @param element the Document Element of this object.
* @throws SAML2Exception if error parsing the Document Element.
*/
private void parseElement(Element element) throws SAML2Exception {
AssertionFactory assertionFactory = AssertionFactory.getInstance();
ProtocolFactory protoFactory = ProtocolFactory.getInstance();
responseId = element.getAttribute(SAML2Constants.ID);
validateID(responseId);
version = element.getAttribute(SAML2Constants.VERSION);
validateVersion(version);
String issueInstantStr = element.getAttribute(SAML2Constants.ISSUE_INSTANT);
validateIssueInstant(issueInstantStr);
destination = element.getAttribute(SAML2Constants.DESTINATION);
consent = element.getAttribute(SAML2Constants.CONSENT);
inResponseTo = element.getAttribute(SAML2Constants.INRESPONSETO);
NodeList nList = element.getChildNodes();
if ((nList != null) && (nList.getLength() > 0)) {
for (int i = 0; i < nList.getLength(); i++) {
Node childNode = nList.item(i);
String cName = childNode.getLocalName();
if (cName != null) {
if (cName.equals(SAML2Constants.ISSUER)) {
issuer = assertionFactory.createIssuer((Element) childNode);
} else if (cName.equals(SAML2Constants.SIGNATURE)) {
signatureString = XMLUtils.getElementString((Element) childNode);
isSigned = true;
} else if (cName.equals(SAML2Constants.EXTENSIONS)) {
extensions = protoFactory.createExtensions((Element) childNode);
} else if (cName.equals(SAML2Constants.STATUS)) {
status = protoFactory.createStatus((Element) childNode);
validateStatus();
}
}
}
}
}
use of com.sun.identity.saml2.assertion.AssertionFactory in project OpenAM by OpenRock.
the class AssertionIDRequestImpl method parseDOMChileElements.
/**
* Parses child elements of the Docuemnt Element for this object.
*
* @param iter the child elements iterator.
* @throws SAML2Exception if error parsing the Document Element.
*/
protected void parseDOMChileElements(ListIterator iter) throws SAML2Exception {
super.parseDOMChileElements(iter);
AssertionFactory aFactory = AssertionFactory.getInstance();
while (iter.hasNext()) {
Element childElement = (Element) iter.next();
String localName = childElement.getLocalName();
if (SAML2Constants.ASSERTION_ID_REF.equals(localName)) {
AssertionIDRef assertionIDRef = aFactory.createAssertionIDRef(childElement);
if (assertionIDRefs == null) {
assertionIDRefs = new ArrayList();
}
assertionIDRefs.add(assertionIDRef);
} else {
iter.previous();
break;
}
}
if (assertionIDRefs == null) {
throw new SAML2Exception(SAML2Utils.bundle.getString("schemaViolation"));
}
}
use of com.sun.identity.saml2.assertion.AssertionFactory in project OpenAM by OpenRock.
the class AttributeQueryImpl method parseDOMChileElements.
/**
* Parses child elements of the Docuemnt Element for this object.
*
* @param iter the child elements iterator.
* @throws SAML2Exception if error parsing the Document Element.
*/
protected void parseDOMChileElements(ListIterator iter) throws SAML2Exception {
super.parseDOMChileElements(iter);
AssertionFactory assertionFactory = AssertionFactory.getInstance();
while (iter.hasNext()) {
Element childElement = (Element) iter.next();
String localName = childElement.getLocalName();
if (SAML2Constants.ATTRIBUTE.equals(localName)) {
if (attributes == null) {
attributes = new ArrayList();
}
attributes.add(assertionFactory.createAttribute(childElement));
} else {
iter.previous();
}
}
}
use of com.sun.identity.saml2.assertion.AssertionFactory in project OpenAM by OpenRock.
the class ManageNameIDResponseImpl method parseElement.
private void parseElement(Element element) throws SAML2Exception {
AssertionFactory af = AssertionFactory.getInstance();
ProtocolFactory pf = ProtocolFactory.getInstance();
// make sure that the input xml block is not null
if (element == null) {
if (SAML2SDKUtils.debug.messageEnabled()) {
SAML2SDKUtils.debug.message("ManageNameIDResponseImpl.parseElement: Input is null.");
}
throw new SAML2Exception(SAML2SDKUtils.bundle.getString("nullInput"));
}
// Make sure this is an EncryptedAssertion.
String tag = null;
tag = element.getLocalName();
if ((tag == null) || (!tag.equals(elementName))) {
if (SAML2SDKUtils.debug.messageEnabled()) {
SAML2SDKUtils.debug.message("ManageNameIDResponseImpl.parseElement:" + "not ManageNameIDResponse.");
}
throw new SAML2Exception(SAML2SDKUtils.bundle.getString("wrongInput"));
}
responseId = element.getAttribute("ID");
validateID(responseId);
version = element.getAttribute("Version");
validateVersion(version);
String issueInstantStr = element.getAttribute("IssueInstant");
validateIssueInstant(issueInstantStr);
destination = element.getAttribute("Destination");
consent = element.getAttribute("Consent");
inResponseTo = element.getAttribute("InResponseTo");
NodeList nList = element.getChildNodes();
if ((nList != null) && (nList.getLength() > 0)) {
for (int i = 0; i < nList.getLength(); i++) {
Node childNode = nList.item(i);
String cName = childNode.getLocalName();
if (cName != null) {
if (cName.equals("Issuer")) {
issuer = af.createIssuer((Element) childNode);
} else if (cName.equals("Signature")) {
signatureString = XMLUtils.getElementString((Element) childNode);
isSigned = true;
} else if (cName.equals("Extensions")) {
extensions = pf.createExtensions((Element) childNode);
} else if (cName.equals("Status")) {
status = pf.createStatus((Element) childNode);
}
}
}
}
}
use of com.sun.identity.saml2.assertion.AssertionFactory in project OpenAM by OpenRock.
the class NameIDMappingRequestImpl method parseDOMChileElements.
/**
* Parses child elements of the Docuemnt Element for this object.
*
* @param iter the child elements iterator.
* @throws SAML2Exception if error parsing the Document Element.
*/
protected void parseDOMChileElements(ListIterator iter) throws SAML2Exception {
super.parseDOMChileElements(iter);
AssertionFactory assertionFactory = AssertionFactory.getInstance();
if (iter.hasNext()) {
Element childElement = (Element) iter.next();
String localName = childElement.getLocalName();
if (SAML2Constants.BASEID.equals(localName)) {
baseID = assertionFactory.createBaseID(childElement);
} else if (SAML2Constants.NAMEID.equals(localName)) {
nameID = assertionFactory.createNameID(childElement);
} else if (SAML2Constants.ENCRYPTEDID.equals(localName)) {
encryptedID = assertionFactory.createEncryptedID(childElement);
} else {
throw new SAML2Exception(SAML2SDKUtils.bundle.getString("nameIDMReqWrongID"));
}
} else {
throw new SAML2Exception(SAML2SDKUtils.bundle.getString("nameIDMReqWrongID"));
}
if (iter.hasNext()) {
Element childElement = (Element) iter.next();
String localName = childElement.getLocalName();
if (SAML2Constants.NAMEID_POLICY.equals(localName)) {
nameIDPolicy = ProtocolFactory.getInstance().createNameIDPolicy(childElement);
} else {
throw new SAML2Exception(SAML2SDKUtils.bundle.getString("nameIDMReqMissingNameIDPolicy"));
}
} else {
throw new SAML2Exception(SAML2SDKUtils.bundle.getString("nameIDMReqMissingNameIDPolicy"));
}
}
Aggregations