RequestSecurityToken_Impl.java revision 4a2f0f0be43dfd4c1b490cbf3cc48b6ba6084b1c
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * The contents of this file are subject to the terms
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * of the Common Development and Distribution License
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * (the License). You may not use this file except in
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * compliance with the License.
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * You can obtain a copy of the License at
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * https://opensso.dev.java.net/public/CDDLv1.0.html or
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * See the License for the specific language governing
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * permission and limitations under the License.
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * When distributing Covered Code, include this CDDL
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * Header Notice in each file and include the License file
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * If applicable, add the following below the CDDL Header,
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * with the fields enclosed by brackets [] replaced by
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * your own identifying information:
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * "Portions Copyrighted [year] [name of copyright owner]"
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest * $Id: RequestSecurityToken_Impl.java,v 1.3 2009/10/13 23:19:50 mallas Exp $
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrestimport com.sun.identity.wss.trust.RequestSecurityToken;
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrestimport com.sun.identity.wss.trust.WSTException;
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrestpublic class RequestSecurityToken_Impl extends RequestSecurityToken {
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest // Constructor
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest public RequestSecurityToken_Impl(Element element) throws WSTException {
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest //TODO Schema checking
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest if(!REQUEST_SECURITY_TOKEN.equals(element.getLocalName())) {
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest if(!STSConstants.WST10_NAMESPACE.equals(element.getNamespaceURI())) {
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest if(node.getNodeType() != Node.ELEMENT_NODE) {
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest requestType = XMLUtils.getElementValue(child);
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest for (int j =0; j < claimNodes.getLength(); j++) {
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest public Element toDOMElement() throws WSTException {
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest toXMLString(), STSUtils.debug).getDocumentElement();
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest public String toXMLString() throws WSTException {
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest sb.append("<").append(STSConstants.WST_PREFIX)
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append(STSConstants.WST_XMLNS).append("=\"")
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append(STSConstants.WST10_NAMESPACE).append("\"")
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append(" ").append(STSConstants.WSP_XMLNS).append("=")
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append("\"").append(STSConstants.WSP_NS).append("\"")
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append(" ").append(STSConstants.WSA_XMLNS).append("=")
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append("\"").append(STSConstants.WSA_NS).append("\"")
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest sb.append("<").append(STSConstants.WST_PREFIX).append(TOKEN_TYPE)
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest if(requestType == null || requestType.length() == 0) {
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest throw new WSTException("RequestType is null");
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest sb.append("<").append(STSConstants.WST_PREFIX).append(REQUEST_TYPE)
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append(">").append(requestType).append("</")
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest sb.append("<").append(STSConstants.WSP_PREFIX)
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append(EP_REFERENCE).append(">").append("<")
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append(ADDRESS).append(">").append(appliesTo)
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append("</").append(STSConstants.WSA_PREFIX)
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append("</").append(STSConstants.WSA_PREFIX)
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest .append("</").append(STSConstants.WSP_PREFIX)
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest if(claimTypes != null && !claimTypes.isEmpty()) {
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest sb.append("<").append(STSConstants.WST_PREFIX)
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest .append(CLAIMS).append(" Dialect=").append("\"")
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest .append(ClaimType.IDENTITY_NS).append("\"").append(">");
6202ba4d983650b484ebe9607707003fef5e09c6Andrew Forrest for (Iterator iter = claimTypes.iterator(); iter.hasNext();) {
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest sb.append("</").append(STSConstants.WST_PREFIX)
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest sb.append("<").append(STSConstants.WST_PREFIX)
48dc7c385d64e5d3906d6979100f106e857b4c02Andrew Forrest .append(XMLUtils.print(oboToken)).append("</")
ea65b6bac936db133a660beef9d75f044dd7ce84Andrew Forrest sb.append("<").append(STSConstants.WST_PREFIX)