a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Copyright (c) 2006 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: RequestAuthnContext.java,v 1.2 2008/06/25 05:46:47 qcheng Exp $
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Portions Copyrighted 2014 ForgeRock AS
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterpackage com.sun.identity.federation.message.common;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.federation.common.FSUtils;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.federation.common.IFSConstants;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.saml.common.SAMLConstants;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.shared.encode.URLEncDec;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * This class <code>RequestAuthnContext</code> represents the requesting
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Authentication Context as part of the <code>FSAuthnRequest</code>.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @supported.all.api
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @deprecated since 12.0.0
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster private List authnContextStatementRefList = null;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Constructor to create <code>RequestAuthnContext</code> object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param authnContextClassRefList
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Ordered list of AuthnContext Classes Refs.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param authnContextStatementRefList
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Ordered list of AuthnContext Statement Refs.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Note: authnContextClassRefList and authContextStatementRefList
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * are mutually exclusive lists.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param authnContextComparison AuthnContext Comparison Type.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Possible values are <code>exact</code>, <code>minimum<code>,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * <code>better</code> and <code>maximum</code>.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster this.authnContextStatementRefList = authnContextStatementRefList;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster this.authnContextClassRefList = authnContextClassRefList;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster this.authnContextComparison = authnContextComparison;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Default constructor.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Constructor to create <code>RequestAuthnContext</code> object from
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Docuemnt Element.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param root the Document Element.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @throws FSMsgException on error.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public RequestAuthnContext(Element root) throws FSMsgException {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster FSUtils.debug.message("AuthnContext.parseXML: null input.");
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster FSUtils.debug.error("AuthnContext.parseXML: wrong input.");
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if(!tag.equals("RequestAuthnContext") && !tag.equals("AuthnContext")) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster FSUtils.debug.error("AuthnContext.parseXML: wrong input.");
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster FSUtils.debug.error("AuthnContext(Element): Should"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster + "contain either <AuthnContextStatementRef> or "
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster + "<AuthnContextClassRef>");
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster authnContextClassRefList == Collections.EMPTY_LIST) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster } else if (childName.equals("AuthnContextStatementRef")) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster FSUtils.debug.error("AuthnContext(Element): Should"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster + "contain either <AuthnContextStatementRef> or "
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster + "<AuthnContextClassRef>");
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster authnContextStatementRefList == Collections.EMPTY_LIST) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster authnContextStatementRefList = new ArrayList();
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster } else if(childName.equals("AuthnContextComparison")) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster authnContextComparison = XMLUtils.getElementValue(
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns <code>List</code> of <code>AuthnContext</code> Class References.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return <code>List</code> of <code>AuthnContext</code> Class Reference
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #setAuthnContextClassRefList(List)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets a <code>List</code> of <code>AuthnContext</code> Class References.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param authnContextClassRefList a <code>List</code> of
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * <code>AuthnContext</code> Class References.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #getAuthnContextClassRefList
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster this.authnContextClassRefList = authnContextClassRefList;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns a <code>List</code> of <code>AuthnContext</code> Statement
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * References.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return a <code>List</code> of <code>AuthnContext</code> Statement
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * References.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #setAuthnContextStatementRefList(List)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public List getAuthnContextStatementRefList() {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets a <code>List</code> of <code>AuthnContext</code> Statement
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * References.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param authnContextStatementRefList a <code>List</code> of
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * <code>AuthnContext</code> Statement References.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #getAuthnContextStatementRefList
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster this.authnContextStatementRefList = authnContextStatementRefList;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the <code>AuthnContext</code> Comparison type.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return authnContextComparison the <code>AuthnContext</code> Comparison
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #setAuthnContextComparison(String)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets the <code>AuthnContext</code> comparison type.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param authnContextComparison the <code>AuthnContext</code> comparison
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #getAuthnContextComparison
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public void setAuthnContextComparison(String authnContextComparison) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster this.authnContextComparison = authnContextComparison;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the <code>MinorVersion</code>.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return the <code>MinorVersion</code>.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #setMinorVersion(int)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets the <code>MinorVersion</code>.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param minorVersion the <code>MinorVersion</code>.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #getMinorVersion()
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public void setMinorVersion(int minorVersion) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns a String representation of the Logout Response.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return a string containing the valid XML for this element
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @throws FSMsgException if there is an error converting
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * this object ot a string.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public String toXMLString() throws FSMsgException {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster return this.toXMLString(true, false);
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns a String representation of this object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param includeNS : Determines whether or not the namespace qualifier
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * is prepended to the Element when converted
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param declareNS : Determines whether or not the namespace is declared
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * within the Element.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return a string containing the valid XML for this element
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @throws FSMsgException if there is an error converting
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * this object to a string.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public String toXMLString(boolean includeNS, boolean declareNS)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster return toXMLString(includeNS, declareNS, false);
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns a String representation of the Logout Response.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param includeNS Determines whether or not the namespace qualifier
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * is prepended to the Element when converted
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param declareNS Determines whether or not the namespace is declared
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * within the Element.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param includeHeader Determines whether the output include the xml
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * declaration header.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return a string containing the valid XML for this element
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @throws FSMsgException if there is an error converting
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * this object ot a string.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public String toXMLString(boolean includeNS, boolean declareNS,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster xml.append("<?xml version=\"1.0\" encoding=\"").
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster append(SAMLConstants.DEFAULT_ENCODING).append("\" ?>\n");
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if(minorVersion == IFSConstants.FF_12_PROTOCOL_MINOR_VERSION) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if(minorVersion == IFSConstants.FF_12_PROTOCOL_MINOR_VERSION) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster (authnContextClassRefList != Collections.EMPTY_LIST)) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster (authnContextClassRefList != Collections.EMPTY_LIST)) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster throw new FSMsgException("ExclusiveEntries",null);
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster Iterator j = authnContextClassRefList.iterator();
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster while (j.hasNext()) {
while (j.hasNext()) {
* @return <code><RequestAuthnContext/code> object.
throws FSMsgException {
new ArrayList();
return retAuthnContext;
while(j.hasNext()) {
while (j.hasNext()) {