/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: AuthnContextImpl.java,v 1.3 2008/06/25 05:47:43 qcheng Exp $
*
* Portions Copyrighted 2015 ForgeRock AS.
*/
/**
* This is the default implementation of interface <code>AuthnContext</code>.
*
* The <code>AuthnContext</code> element specifies the context of an
* authentication event. The element can contain an authentication context
* class reference, an authentication declaration or declaration reference,
* or both. Its type is <code>AuthnContextType</code>.
* <p>
* <pre>
* <complexType name="AuthnContextType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <choice>
* <sequence>
* <element ref="{urn:oasis:names:tc:SAML:2.0:assertion}
* AuthnContextClassRef"/>
* <choice minOccurs="0">
* <element ref="{urn:oasis:names:tc:SAML:2.0:assertion}
* AuthnContextDecl"/>
* <element ref="{urn:oasis:names:tc:SAML:2.0:assertion}
* AuthnContextDeclRef"/>
* </choice>
* </sequence>
* <choice>
* <element ref="{urn:oasis:names:tc:SAML:2.0:assertion}
* AuthnContextDecl"/>
* <element ref="{urn:oasis:names:tc:SAML:2.0:assertion}
* AuthnContextDeclRef"/>
* </choice>
* </choice>
* <element ref="{urn:oasis:names:tc:SAML:2.0:assertion}
* AuthenticatingAuthority" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*/
private boolean mutable = true;
// verify the data according to the schema.
if ((authnContextClassRef == null ||
(authnContextDecl == null ||
(authnContextDeclRef == null ||
{
+ "missing AuthnContextClassRef or AuthnContextDecl(Ref).");
}
throw new SAML2Exception(
}
&& authnContextDeclRef != null
{
+ "AuthnContextDecl and AuthnContextDeclRef cannot "
+ "present the same time.");
}
throw new SAML2Exception(
}
}
// used by the constructors.
{
// make sure that the input xml block is not null
+" Input is null.");
}
throw new SAML2Exception(
}
// Make sure this is an AuthnContext.
+ " not AuthnContext.");
}
throw new SAML2Exception(
}
for (int i = 0; i < length; i++) {
if (authnContextClassRef != null) {
+ "Element: included more than one AuthnContext"
+ "ClassRef.");
}
throw new SAML2Exception(
}
if (authnContextDecl != null ||
authnContextDeclRef != null ||
{
+ "Element: AuthnContextClassRef should be "
+ "the first child element.");
}
throw new SAML2Exception(
}
if (authnContextClassRef == null ||
{
+"parseElement: value for AuthnContextClassRef "
+ "is empty.");
}
throw new SAML2Exception(
getString("missingElementValue"));
}
if (authnContextDecl != null) {
+ "Element: included more than one AuthnContext"
+ "Decl.");
}
throw new SAML2Exception(
}
if (authnContextDecl == null ||
{
+"parseElement: value for AuthnContextDecl "
+ "is empty.");
}
throw new SAML2Exception(
getString("missingElementValue"));
}
if (authnContextDeclRef != null) {
+ "Element: included more than one AuthnContext"
+ "DeclRef.");
}
throw new SAML2Exception(
}
if (authnContextDeclRef == null ||
{
+"parseElement: value for AuthnContextDeclRef "
+ "is empty.");
}
throw new SAML2Exception(
getString("missingElementValue"));
}
+"parseElement: value for"
+" AuthenticatingAuthority is empty.");
}
throw new SAML2Exception(
getString("missingElementValue"));
}
if (authenticatingAuthority == null) {
}
} else {
+"parseElement: Invalid element:" + childName);
}
throw new SAML2Exception(
}
}
}
// Commenting this until we get a fix from WSIT
// validateData();
if (authenticatingAuthority != null) {
}
mutable = false;
}
/**
* Class constructor. Caller may need to call setters to populate the
* object.
*/
public AuthnContextImpl() {
}
/**
* Class constructor with <code>AuthnContext</code> in <code>Element</code>
* format.
*/
{
}
/**
* Class constructor with <code>AuthnContext</code> in xml string format.
*/
{
throw new SAML2Exception(
}
}
/**
* Makes the object immutable.
*/
public void makeImmutable() {
}
mutable = false;
}
/**
* Returns the mutability of the object.
*
* @return <code>true</code> if the object is mutable;
* <code>false</code> otherwise.
*/
public boolean isMutable() {
return mutable;
}
/**
* Returns the value of the <code>AuthnContextClassRef</code> property.
*
* @return the value of the <code>AuthnContextClassRef</code>.
*/
return authnContextClassRef;
}
/**
* Sets the value of the <code>AuthnContextClassRef</code> property.
*
* @param value new <code>AuthenticationContextClassRef</code>.
* @throws com.sun.identity.saml2.common.SAML2Exception
* if the object is immutable.
*/
{
if (!mutable) {
throw new SAML2Exception(
}
}
/**
* Returns the value of the <code>AuthnContextDeclRef</code> property.
*
* @return A String representing authentication context
* declaration reference.
*/
return authnContextDeclRef;
}
/**
* Sets the value of the <code>AuthnContextDeclRef</code> property.
*
* @param value A String representation of authentication context
* declaration reference.
* @throws com.sun.identity.saml2.common.SAML2Exception
* if the object is immutable.
*/
{
if (!mutable) {
throw new SAML2Exception(
}
}
/**
* Returns the value of the <code>AuthnContextDecl</code> property.
*
* @return An XML String representing authentication context declaration.
*/
return authnContextDecl;
}
/**
* Sets the value of the <code>AuthnContextDecl</code> property.
*
* @param value An XML String representing authentication context
* declaration.
* @throws com.sun.identity.saml2.common.SAML2Exception
* if the object is immutable.
*/
{
if (!mutable) {
throw new SAML2Exception(
}
}
/**
* Sets the value of the <code>AuthenticatingAuthority</code> property.
*
* @param value List of Strings representing authenticating authority.
* @throws SAML2Exception If the object is immutable.
*/
if (!mutable) {
}
}
/**
* Returns the value of the <code>AuthenticatingAuthority</code> property.
*
* @return List of Strings representing
* <code>AuthenticatingAuthority</code>.
*/
return authenticatingAuthority;
}
/**
* Returns a String representation of the element.
*
* @return A string containing the valid XML for this element.
* By default name space name is prepended to the element name.
* @throws com.sun.identity.saml2.common.SAML2Exception
* if the object does not conform to the schema.
*/
{
return this.toXMLString(true, false);
}
/**
* Returns a String representation of the element.
*
* @param includeNS 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 A string containing the valid XML for this element
* @throws com.sun.identity.saml2.common.SAML2Exception
* if the object does not conform to the schema.
*/
{
validateData();
if (includeNS) {
}
if (declareNS) {
}
if (authnContextClassRef != null &&
{
}
if (authnContextDecl != null &&
{
} else if (authnContextDeclRef != null &&
{
}
if (authenticatingAuthority != null) {
}
}
}
}
}