/**
* 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: FSAssertion.java,v 1.2 2008/06/25 05:46:43 qcheng Exp $
* Portions Copyrighted 2014 ForgeRock AS
*/
/**
* The class <code>FSAssertion</code> creates and parses Liberty
* <code>Assertion</code> during the Single Sign-On process.
* This class extends from SAML Assertion.
*
* @supported.all.api
* @deprecated since 12.0.0
*/
/**
* The Document Element of this object.
*/
/**
* The <code>SAMLConstants</code> object.
*/
/**
* The value of the <code>id</code> attribute in the <code>Assertion</code>.
*/
/**
* The value of the <code>MinorVersion</Version> attribute in
* the <code>Assertion</code>.
*/
/**
* List of Security <code>Assertions</code>.
*/
/**
* The value of the <code>InResponseTo</code> attribute in the
* <code>Assertion</code>.
*/
/**
* Constructor to create an <code>FSAssertion</code> object
* from the Document Element.
*
* @param assertionElement the <code>Assertion</code> Document Element.
* @throws FSMsgException if the document element is null
* or cannot be retrieved.
* @throws SAMLException if the SAML Assertion version is
* incorrect
*/
throws FSMsgException, SAMLException {
}
}
}
}
}
} else {
int ver = 0;
try {
} catch ( NumberFormatException ne ) {
"in MajorVersion", ne);
}
"assertionVersionTooLow",null);
"assertionVersionTooHigh",null);
}
}
}
} else {
try {
} catch ( NumberFormatException ne ) {
"FSAssertion: invalid integer in MinorVersion", ne);
}
"assertionVersionTooLow",null);
} else if (minorVersion >
"assertionMinorVersionTooHigh",null);
}
}
}
} else {
}
}
} else {
}
}
} else {
inResponseTo = read;
}
}
} else {
try {
} catch (ParseException pe) {
"FSAssertion: could not parse IssueInstant", pe);
}
}
boolean statementFound = false;
for (int n=0; n<length; n++) {
/**
* The SAML Advice could not parse this advice as it does not
* anything about Resource Access Statement. Hence commenting
* the following and parsing in this assertion only. Currently
* the FSAssertion does not have any advice element besides for
* the credential.
*/
statementFound=true;
statementFound=true;
statementFound=true;
}
} else {
"FSAssertion: invalid element in Assertion");
}
}
}
//check for signature
if (signsSize == 1) {
signed = true;
} else if (signsSize != 0) {
+ " one Signature element.");
}
}
//end check for signature
if (!statementFound) {
}
}
}
/**
* Constructor to create <code>FSAssertion</code> object.
*
* @param assertionID the <code>AssertionID</code> element.
* @param issuer the <code>Issuer</code> element.
* @param issueInstant the <code>IssueInstant</code> element.
* @param statements the <code>Statement</code> elements.
* List of statements that need to be added in assertion.
* @param inResponseTo value of <code>InResponseTo</code> attribute in the
* assertion.
* @throws FSMsgException if the document element is null
* or cannot be retrieved.
* @throws SAMLException if the SAML Assertion version is
* incorrect.
*/
throws FSMsgException, SAMLException {
this.inResponseTo = inResponseTo;
}
/**
* Constructor to create <code>FSAssertion</code> object.
*
* @param assertionID the <code>AssertionID</code> element.
* @param issuer the <code>Issuer</code> element.
* @param issueInstant the <code>IssueInstant</code> element.
* @param conditions the <code>Conditions</code> object.
* @param statements the <code>Statement</code> elements.
* List of statements that need to be added in assertion.
* @param inResponseTo value of <code>InResponseTo</code> attribute in
* the assertion.
* @throws FSMsgException if the document element is null
* or cannot be retrieved.
* @throws SAMLException if the SAML Assertion version is
* incorrect.
*/
throws FSMsgException, SAMLException {
this.inResponseTo = inResponseTo;
}
/**
* Constructor to create an <code>FSAssertion</code> object.
*
* @param assertionID the <code>AssertionID</code> element.
* @param issuer the <code>Issuer</code> element.
* @param issueInstant the <code>IssueInstant</code> element.
* @param conditions the <code>Conditions</code> object.
* @param advice the <code>Advice</code> object.
* @param statements the <code>Statement</code> elements.
* List of statements that need to be added in assertion.
* @param inResponseTo value of <code>InResponseTo</code> attribute
* in the assertion.
* @throws FSMsgException if the document element is null
* or cannot be retrieved.
* @throws SAMLException if the SAML Assertion version is
* incorrect.
*/
throws FSMsgException, SAMLException {
this.inResponseTo = inResponseTo;
}
/**
* Returns value of <code>id</code> attribute.
*
* @return value of <code>id</code> attribute.
* @see #setID(String)
*/
return id;
}
/**
* Sets value of <code>id<code> attribute.
*
* @param id value of <code>id</code> attribute.
* @see #getID
*/
}
/**
* Returns the <code>MinorVersion</code> attribute.
*
* @return the <code>MinorVersion</code> attribute.
* @see #setMinorVersion(int)
*/
public int getMinorVersion() {
return minorVersion;
}
/**
* Sets the <code>MinorVersion</code> attribute.
*
* @param version the <code>MinorVersion</code> attribute.
* @see #getMinorVersion
*/
}
/**
* Returns the Document Element for this object.
*
* @return the Document Element for this object.
*/
return domElement;
}
/**
* Returns the value of <code>InResponseTo</code> attribute.
*
* @return the value of <code>InResponseTo</code> attribute.
* @see #setInResponseTo(String)
*/
return inResponseTo;
}
/**
* Sets the value of <code>InResponseTo</code> attribute.
*
* @param inResponseTo value of <code>InResponseTo</code> attribute.
* @see #getInResponseTo
*/
this.inResponseTo = inResponseTo;
}
/**
* Returns Signed XML String.
*
* @return Signed XML String.
*/
return xmlString;
}
/**
* Returns the <code>Signature</code> string.
*
* @return the <code>Signature</code> string.
*/
return signatureString;
}
/**
* Checks validity of time in the assertion.
*
* @return true if time is valid otherwise false.
*/
public boolean isTimeValid() {
boolean isTimeValid = true;
if (conditions != null) {
}
return isTimeValid;
}
/**
* Adds the <code>Statement</code> object to the
* Statment's object Set.
*
* @param statement the <code>Statement</code> object.
* @return false if statement is null else true.
*/
boolean addedStmt = false;
super.addStatement(statement);
addedStmt = true;
}
return addedStmt;
}
/**
* Returns a <code>XML</code> String representation of this object.
*
* @return a String representation of this Object.
* @throws FSMsgException if there is an error creating
* the <code>XML</code> string.
*/
return this.toXMLString(true, true);
}
/**
* Returns a <code>XML</code> String representation of this object.
*
* @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 <code>XML</code> for this object.
* @throws FSMsgException if there is an error creating
* the <code>XML</code> string.
*/
throws FSMsgException {
if (declareNS) {
|| minorVersion ==
} else {
}
}
if (includeNS) {
}
if (getIssueInstant() != null) {
}
}
if (getConditions() != null) {
}
}
while (i.hasNext()) {
if(st instanceof FSAuthenticationStatement){
includeNS, false));
} else if(st instanceof AttributeStatement) {
}
}
if (signed) {
if (signatureString != null) {
}
}
}
/**
* Signs the <code>Assertion</code>.
*
* @throws SAMLException if <code>FSAssertion</code>
* cannot be signed.
*/
if (signed) {
+ "already signed.");
}
throw new SAMLResponderException(
}
"cannotFindCertAlias",null);
}
try {
false);
} else if (minorVersion ==
|| minorVersion ==
this.getAssertionID(), false);
} else {
}
}
signed = true;
xmlString = this.toXMLString(true, true);
} catch(Exception e){
throw new SAMLResponderException(e);
}
}
/**
* Sets the <code>Element's</code> signature.
*
* @param elem the <code>Element</code> object
* @return true if signature is set otherwise false
*/
return super.setSignature(elem);
}
/**
* Parses the advice element to extract the Security <code>Assertion</code>.
*
* @param element the <code>Advice</code> Element.
*/
for (int n=0; n<length; n++) {
continue;
}
try {
if (securityAssertions == null) {
securityAssertions = new ArrayList();
}
"parsing security assertion", ex);
}
}
}
}
}
/**
* Returns the discovery service credentials from the boot strap.
*
* @return the discovery service credentials from the boot strap.
*/
return securityAssertions;
}
}