/**
* 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: AuthenticationStatement.java,v 1.3 2008/06/25 05:47:31 qcheng Exp $
*
*/
/**
* Portions Copyrighted 2014 ForgeRock AS
*/
/**
* The <code>AuthenticationStatement</code> element supplies a
* statement by the issuer that its subject was authenticated by a
* particular means at a particular time. The
* <code>AuthenticationStatement</code> element is of type
* <code>AuthenticationStatementType</code>, which extends the
* <code>SubjectStatementAbstractType</code> with the additional element and
* attributes.
* @supported.all.api
*/
//The AuthenticationMethod attribute specifies the type of Authentication
//that took place.
//The AuthenticationInstant attribute specifies the time at which the
//authentication took place.
//The SubjectLocality specifies the DNS domain name and IP address
//for the system entity from which the Subject was apparently authenticated.
//The authority binding specifies the type of authority that performed
//the authentication.
/**
*Default constructor
*/
protected AuthenticationStatement() {
}
/**
* Constructs an authentication statement element from an
* existing XML block.
*
* @param element representing a DOM tree element.
* @exception SAMLException if there is an error in the sender or in the
* element definition.
*/
// make sure input is not null
"AuthenticationStatement: null input.");
throw new SAMLRequesterException(
}
// check if it's an AuthenticationStatement
"AuthenticationStatement");
if (!valid) {
"AuthenticationStatement: Wrong input.");
throw new SAMLRequesterException(
}
int i = 0;
//handle the attributes of AuthenticationStatement
for (i = 0; i < attCount; i++) {
"AuthenticationStatement:" +
"Attribute name is either null or empty.");
}
continue;
//throw new SAMLRequesterException(
// SAMLUtilsCommon.bundle.getString("nullInput"));
}
try {
} catch (ParseException pe ) {
"AuthenticationStatement:StringToDate", pe);
throw new SAMLRequesterException(
"wrongDateFormat"));
} // end of try...catch
}
}
} // end of for loop
//Handle the children elements of AuthenticationStatement
if (nodeCount > 0) {
for (i = 0; i < nodeCount; i++) {
"AuthenticationStatement: The" +
" tag name or tag namespace of child" +
" element is either null or empty.");
}
throw new SAMLRequesterException(
}
"Statement:should only contain one subject");
}
throw new SAMLRequesterException(
} else {
this._subject =
}
if (_subjectLocality != null) {
"Statement: should at most " +
"contain one SubjectLocality.");
}
throw new SAMLRequesterException(
"oneElement"));
} else {
}
if (_authorityBinding == null) {
_authorityBinding = new ArrayList();
}
(Element)currentNode))) == false) {
"Authentication Statment: failed to" +
" add to the AuthorityBinding list.");
}
throw new SAMLRequesterException(
"addListError"));
}
} else {
"AuthenticationStatement:"+
}
throw new SAMLRequesterException(
}
} // end of if (currentNode.getNodeType() == Node.ELEMENT_NODE)
} // end of for loop
} // end of if (nodeCount > 0)
// check if the subject is null
"AuthenticationStatement should " +
"contain one subject.");
}
throw new SAMLRequesterException(
}
}
/**
* Constructs <code>Authentication statement</code>
*
* @param authMethod (optional) A String specifies the type of
* authentication that took place.
* @param authInstant (optional) A String specifies the time at which
* the authentication took place.
* @param subject (required) A Subject object
* @exception SAMLException if there is an error in the sender.
*/
// check if the subject is null
"AuthenticationStatement:missing the subject.");
}
throw new SAMLRequesterException(
} else
}
/**
* Constructs <code>AuthenticationStatement</code>
*
* @param authMethod (optional) A String specifies the type of
* authentication that took place.
* @param authInstant (optional) A String specifies the time at which the
* authentication that took place.
* @param subject (required) A Subject object
* @param subjectLocality (optional) A <code>SubjectLocality</code> object.
* @param authorityBinding (optional) A List of
* <code>AuthorityBinding</code> objects.
* @exception SAMLException if there is an error in the sender.
*/
// check if the subject is null
"AuthenticationStatement: should" +
" contain one subject.");
}
throw new SAMLRequesterException(
} else {
}
if (_authorityBinding == null) {
_authorityBinding = new ArrayList();
}
}
}
/**
* Returns the <code>SubjectLocality</code> from
* <code>AuthenticationStatement</code>
*
* @return The <code>SubjectLocality</code> object within the authentication
* statement.
*/
return _subjectLocality ;
}
/**
* Sets the <code>SubjectLocality</code> for
* <code>AuthenticationStatement</code>.
*
* @param subjectlocality The <code>SubjectLocality</code> object within
* the <code>AuthenticationStatement</code>.
* @return true if the operation is successful.
*/
if (subjectlocality == null) {
"setSubjectLocality:Input is null.");
}
return false;
}
return true;
}
/**
* Returns <code>AuthenticationMethod</code> from authentication statement
* @return A String representing the authentication method of the
* authentication statement.
*/
return _authenticationMethod;
}
/**
* Sets <code>AuthenticationMethod</code> for
* <code>AuthenticationStatement</code>.
*
* @param authenticationmethod input authentication method
* @return true if the operation is successful. Otherwise return false.
*/
if (authenticationmethod == null ||
"setAuthenticationMethod:Input is null.");
}
return false;
}
return true;
}
/**
* Returns <code>AuthenticationInstant</code> from authentication statement.
*/
return _authenticationInstant;
}
/**
* Sets <code>AuthenticationInstant</code> for
* <code>AuthenticationStatement</code>.
*
* statement is created.
* @return true if the operation is successful.
*/
if (authenticationinstant == null) {
"setAuthenticationInstant:Input is null.");
}
return false;
}
return true;
}
/**
* Returns the <code>AuthorityBinding</code> from
* <code>AuthenticationStatement</code>.
*
* @return A list of the <code>AuthorityBinding</code> objects
*/
return _authorityBinding;
}
/**
* Sets the <code>AuthorityBinding</code> for
* <code>AuthenticationStatement</code>.
*
* @param authoritybinding A list of the <code>AuthorityBinding</code>
* objects.
* @return true if the operation is successful.
*/
"setAuthorityBinding:Input is null.");
}
return false;
}
return true;
}
/**
*Gets the real type of the Statement.
*This method returns Statement.AUTHENTICATION_STATEMENT.
*@return an integer which is Statement.AUTHENTICATION_STATEMENT.
*/
public int getStatementType() {
return Statement.AUTHENTICATION_STATEMENT;
}
/**
* Returns a String representation of the Authentication Statement.
*
* @return A String representation of the
* <code><saml:AuthenticationStatement></code>
* element.
*/
return (toString(true, false));
}
/**
* Returns a String representation of the
* <code>AuthenticationStatement</code>
* @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 representation of the
* <code><saml:AuthenticationStatement></code> element.
*/
if (includeNS) {
}
if (declareNS) {
}
if (_authenticationMethod != null &&
}
if (_authenticationInstant != null &&
) {
.append("\"");
}
if (_subjectLocality != null) {
}
}
}
}
throws SAMLException {
return new Subject(subjectElement);
}
throws SAMLException {
return new SubjectLocality(subjectLocalityElement);
}
return new AuthorityBinding(authorityBindingElement);
}
}