a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * The contents of this file are subject to the terms
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * of the Common Development and Distribution License
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * (the License). You may not use this file except in
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * compliance with the License.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * You can obtain a copy of the License at
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * See the License for the specific language governing
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * permission and limitations under the License.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * When distributing Covered Code, include this CDDL
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Header Notice in each file and include the License file
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * If applicable, add the following below the CDDL Header,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * with the fields enclosed by brackets [] replaced by
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * your own identifying information:
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * $Id: AuthnQueryImpl.java,v 1.3 2008/06/25 05:47:59 qcheng Exp $
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.saml2.common.SAML2Constants;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.saml2.common.SAML2Exception;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.saml2.common.SAML2SDKUtils;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.saml2.protocol.AuthnQuery;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.saml2.protocol.ProtocolFactory;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.saml2.protocol.RequestedAuthnContext ;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterpublic class AuthnQueryImpl extends SubjectQueryAbstractImpl
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster protected RequestedAuthnContext requestedAuthnContext;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Constructor to create <code>AuthnQuery</code> Object .
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Constructor to create <code>AuthnQuery</code> Object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param element the Document Element Object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @throws SAML2Exception if error creating <code>AuthnQuery</code>
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public AuthnQueryImpl(Element element) throws SAML2Exception {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Constructor to create <code>AuthnQuery</code> Object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param xmlString the XML String.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @throws SAML2Exception if error creating <code>AuthnQuery</code>
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public AuthnQueryImpl(String xmlString) throws SAML2Exception {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster XMLUtils.toDOMDocument(xmlString,SAML2SDKUtils.debug);
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster SAML2SDKUtils.bundle.getString("errorObtainingElement"));
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster parseDOMElement(xmlDocument.getDocumentElement());
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the <code>RequestedAuthnContext</code> object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return the <code>RequestedAuthnContext</code> object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #setRequestedAuthnContext(RequestedAuthnContext)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public RequestedAuthnContext getRequestedAuthnContext()
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets the <code>RequestedAuthnContext</code> object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param requestedAuthnContext the new <code>RequestedAuthnContext</code>
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @throws SAML2Exception if the object is immutable.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #getRequestedAuthnContext
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster RequestedAuthnContext requestedAuthnContext) throws SAML2Exception {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster SAML2SDKUtils.bundle.getString("objectImmutable"));
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster this.requestedAuthnContext = requestedAuthnContext;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the value of the <code>SessionIndex</code> attribute.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return value of <code>SessionIndex</code> attribute.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #setSessionIndex(String)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets the value of <code>SessionIndex</code> attribute.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param sessionIndex new value of the <code>SessionIndex</code> attribute.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @throws SAML2Exception if the object is immutable.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #getSessionIndex
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public void setSessionIndex(String sessionIndex) throws SAML2Exception{
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster SAML2SDKUtils.bundle.getString("objectImmutable"));
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster protected void getXMLString(Set namespaces, StringBuffer attrs,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster StringBuffer childElements, boolean includeNSPrefix, boolean declareNS)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster namespaces.add(SAML2Constants.PROTOCOL_DECLARE_STR.trim());
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster namespaces.add(SAML2Constants.ASSERTION_DECLARE_STR.trim());
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster super.getXMLString(namespaces, attrs, childElements, includeNSPrefix,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if ((sessionIndex != null) && (sessionIndex.length() > 0)) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster .append(SAML2Constants.EQUAL).append(SAML2Constants.QUOTE)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster .append(sessionIndex).append(SAML2Constants.QUOTE);
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster childElements.append(requestedAuthnContext.toXMLString(
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster includeNSPrefix, declareNS)).append(SAML2Constants.NEWLINE);
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Parses attributes of the Docuemnt Element for this object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param element the Document Element of this object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @throws SAML2Exception if error parsing the Document Element.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster protected void parseDOMAttributes(Element element) throws SAML2Exception {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster sessionIndex = element.getAttribute(SAML2Constants.SESSION_INDEX);
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Parses child elements of the Docuemnt Element for this object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param iter the child elements iterator.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @throws SAML2Exception if error parsing the Document Element.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster protected void parseDOMChileElements(ListIterator iter)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster ProtocolFactory pFactory = ProtocolFactory.getInstance();
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster String localName = childElement.getLocalName() ;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if (SAML2Constants.REQ_AUTHN_CONTEXT.equals(localName)) {