use of com.sun.identity.saml.protocol.AuthenticationQuery in project OpenAM by OpenRock.
the class FSRequest method parseQuery.
/**
* Parses the Query or <code>SubjectQuery</code> represented by
* a DOM tree Node. It then checks and sets data members if it is a
* supported query, such as <code>AuthenticationQuery</code>,
* <code>AttributeQeury</code>, or <code>AuthorizationDecisionQuery</code>.
*
* @param child a <code>DOM</code> Node.
* @throws <code>SAMLException</code> if the <code>Query</code> is invalid.
*/
private void parseQuery(Node child) throws SAMLException {
NamedNodeMap nm = child.getAttributes();
int len = nm.getLength();
String attrName;
String attrValue;
Attr attr;
boolean found = false;
for (int j = 0; j < len; j++) {
attr = (Attr) nm.item(j);
attrName = attr.getLocalName();
if ((attrName != null) && (attrName.equals("type"))) {
attrValue = attr.getNodeValue();
if (attrValue.equals("AuthenticationQueryType")) {
if (contentType != NOT_SUPPORTED) {
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message("Request(Element): should" + " contain only one AuthenticationQuery.");
}
throw new SAMLRequesterException(FSUtils.BUNDLE_NAME, "wrongInput", null);
}
contentType = AUTHENTICATION_QUERY;
query = new AuthenticationQuery((Element) child);
} else if (attrValue.equals("AuthorizationDecisionQueryType")) {
if (contentType != NOT_SUPPORTED) {
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message("Request(Element): should " + "contain one " + "AuthorizationDecisionQuery.");
}
throw new SAMLRequesterException(FSUtils.BUNDLE_NAME, "wrongInput", null);
}
contentType = AUTHORIZATION_DECISION_QUERY;
query = new AuthorizationDecisionQuery((Element) child);
} else if (attrValue.equals("AttributeQueryType")) {
if (contentType != NOT_SUPPORTED) {
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message("Request(Element): should " + "contain one AttributeQuery.");
}
throw new SAMLRequesterException(FSUtils.BUNDLE_NAME, "wrongInput", null);
}
contentType = ATTRIBUTE_QUERY;
query = new AttributeQuery((Element) child);
} else {
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message("Request(Element): This type of" + " " + attrName + " is not supported.");
}
throw new SAMLResponderException(FSUtils.BUNDLE_NAME, "queryNotSupported", null);
}
// check typevalue
found = true;
break;
}
// if found type attribute
}
// if not found type
if (!found) {
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message("Request(Element): missing" + " xsi:type definition in " + child.getLocalName());
}
throw new SAMLRequesterException(FSUtils.BUNDLE_NAME, "wrongInput", null);
}
}
Aggregations