Search in sources :

Example 1 with RequesterID

use of com.sun.identity.saml2.protocol.RequesterID in project OpenAM by OpenRock.

the class ScopingImpl method toXMLString.

/**
     * Returns a String representation
     *
     * @param includeNSPrefix determines whether or not the namespace
     *	      qualifier is prepended to the Element when converted
     * @param declareNS determines whether or not the namespace is declared
     *	      within the Element.
     * @return the String representation of this Object.
     * @throws SAML2Exception if String object cannot be created.
     */
public String toXMLString(boolean includeNSPrefix, boolean declareNS) throws SAML2Exception {
    String xmlElementString = null;
    if (idpList != null || (requesterIDList != null && !requesterIDList.isEmpty()) || proxyCount != null) {
        validateProxyCount(proxyCount);
        StringBuilder xmlString = new StringBuilder(300);
        xmlString.append(SAML2Constants.START_TAG);
        if (includeNSPrefix) {
            xmlString.append(SAML2Constants.PROTOCOL_PREFIX);
        }
        xmlString.append(SAML2Constants.SCOPING);
        if (declareNS) {
            xmlString.append(SAML2Constants.PROTOCOL_DECLARE_STR);
        }
        if (proxyCount != null) {
            xmlString.append(SAML2Constants.SPACE).append(PROXYCOUNT).append(SAML2Constants.EQUAL).append(SAML2Constants.QUOTE).append(proxyCount.intValue()).append(SAML2Constants.QUOTE);
        }
        xmlString.append(SAML2Constants.END_TAG).append(SAML2Constants.NEWLINE);
        if (idpList != null) {
            xmlString.append(idpList.toXMLString(includeNSPrefix, declareNS)).append(SAML2Constants.NEWLINE);
        }
        if (requesterIDList != null) {
            for (RequesterID reqID : requesterIDList) {
                String reqIDStr = reqID.toXMLString(includeNSPrefix, declareNS);
                xmlString.append(reqIDStr).append(SAML2Constants.NEWLINE);
            }
        }
        xmlString.append(SAML2Constants.SAML2_END_TAG).append(SAML2Constants.SCOPING).append(SAML2Constants.END_TAG);
        xmlElementString = xmlString.toString();
    }
    return xmlElementString;
}
Also used : RequesterID(com.sun.identity.saml2.protocol.RequesterID)

Example 2 with RequesterID

use of com.sun.identity.saml2.protocol.RequesterID in project OpenAM by OpenRock.

the class ScopingImpl method parseElement.

private void parseElement(Element element) throws SAML2Exception {
    String proxyCountStr = element.getAttribute("ProxyCount");
    if (proxyCountStr != null && proxyCountStr.length() > 0) {
        proxyCount = new Integer(proxyCountStr);
        validateProxyCount(proxyCount);
    }
    NodeList nList = element.getChildNodes();
    if ((nList != null) && (nList.getLength() > 0)) {
        if (requesterIDList == null) {
            requesterIDList = new ArrayList<RequesterID>();
        }
        for (int i = 0; i < nList.getLength(); i++) {
            Node childNode = nList.item(i);
            String cName = childNode.getLocalName();
            if (cName != null) {
                if (cName.equals(SAML2Constants.IDPLIST)) {
                    validateIDPList();
                    idpList = ProtocolFactory.getInstance().createIDPList((Element) childNode);
                } else if (cName.equals(SAML2Constants.REQUESTERID)) {
                    RequesterID reqID = ProtocolFactory.getInstance().createRequesterID((Element) childNode);
                    requesterIDList.add(reqID);
                }
            }
        }
        if (requesterIDList != null && !requesterIDList.isEmpty()) {
            requesterIDList = Collections.unmodifiableList(requesterIDList);
        }
    }
}
Also used : NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Element(org.w3c.dom.Element) RequesterID(com.sun.identity.saml2.protocol.RequesterID)

Aggregations

RequesterID (com.sun.identity.saml2.protocol.RequesterID)2 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1