StatusResponseImpl.java revision 09a5cc2cbb7b3481ab44acfc09d86e9e97bea88a
/**
* 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: StatusResponseImpl.java,v 1.4 2008/06/25 05:48:01 qcheng Exp $
*
* Portions Copyrighted 2015-2016 ForgeRock AS.
*/
/**
* This class defines methods for setting and retrieving attributes and
* elements associated with a SAML response message used in SAML protocols.
* This class is the base class for all SAML Responses.
*/
public abstract class StatusResponseImpl implements StatusResponse {
protected boolean isSigned = false;
protected boolean isMutable = false;
/**
* Returns the value of the version property.
*
* @return the value of the version property
* @see #setVersion(String)
*/
return version;
}
/**
* Sets the value of the version property.
*
* @param value the value of the version property to be set
* @throws SAML2Exception if the object is immutable
* @see #getVersion
*/
if (isMutable) {
} else {
throw new SAML2Exception(
}
}
/**
* Returns the value of the issueInstant property.
*
* @return the value of the issueInstant property
* @see #setIssueInstant(java.util.Date)
*/
return issueInstant;
}
/**
* Sets the value of the issueInstant property.
*
* @param value the value of the issueInstant property to be set
* @throws SAML2Exception if the object is immutable
* @see #getIssueInstant
*/
if (isMutable) {
this.issueInstant = value;
} else {
throw new SAML2Exception(
}
}
/**
* Returns the value of the destination property.
*
* @return the value of the destination property
* @see #setDestination(String)
*/
return destination;
}
/**
* Sets the value of the destination property.
*
* @param value the value of the destination property to be set
* @throws SAML2Exception if the object is immutable
* @see #getDestination
*/
if (isMutable) {
this.destination = value;
} else {
throw new SAML2Exception(
}
}
/**
* Returns the signature element, the <code>StatusResponse</code> contains
* as <code>String</code>.
* It returns null if the <code>StatusResponse</code> has no signature.
*
* @return <code>String</code> representation of the signature.
*
*/
public String getSignature() {
return signatureString;
}
/** Signs the StatusResponse
*
* @param privateKey Signing key
* @param cert Certificate which contain the public key correlated to
* the signing key; It if is not null, then the signature
* will include the certificate; Otherwise, the signature
* will not include any certificate.
* @throws SAML2Exception if it could not sign the Request.
*/
throws SAML2Exception {
toXMLString(true, true),
getID(),
);
getDocumentElement(), "UTF-8");
isSigned =true;
}
/**
* Returns the value of the extensions property.
*
* @return the value of the extensions property
* @see #setExtensions(Extensions)
*/
public Extensions getExtensions() {
return extensions;
}
/**
* Sets the value of the extensions property.
*
* @param value the value of the extensions property to be set
* @throws SAML2Exception if the object is immutable
* @see #getExtensions
*/
if (isMutable) {
this.extensions = value;
} else {
throw new SAML2Exception(
}
}
/**
* Returns the value of the consent property.
*
* @return the value of the consent property
* @see #setConsent(String)
*/
return consent;
}
/**
* Sets the value of the consent property.
*
* @param value the value of the consent property to be set
* @throws SAML2Exception if the object is immutable
* @see #getConsent
*/
if (isMutable) {
} else {
throw new SAML2Exception(
}
}
/**
* Returns the value of the inResponseTo property.
*
* @return the value of the inResponseTo property
* @see #setInResponseTo(String)
*/
return inResponseTo;
}
/**
* Sets the value of the inResponseTo property.
*
* @param value the value of the inResponseTo property to be set
* @throws SAML2Exception if the object is immutable
* @see #getInResponseTo
*/
if (isMutable) {
this.inResponseTo = value;
} else {
throw new SAML2Exception(
}
}
/**
* Returns the value of the status property.
*
* @return the value of the status property
* @see #setStatus(Status)
*/
return status;
}
/**
* Sets the value of the status property.
*
* @param value the value of the status property to be set
* @throws SAML2Exception if the object is immutable
* @see #getStatus
*/
throws SAML2Exception {
if (isMutable) {
} else {
throw new SAML2Exception(
}
}
/**
* Returns the value of the id property.
*
* @return the value of the id property
* @see #setID(String)
*/
return responseId;
}
/**
* Sets the value of the id property.
*
* @param value the value of the id property to be set
* @throws SAML2Exception if the object is immutable
* @see #getID
*/
if (isMutable) {
this.responseId = value;
} else {
throw new SAML2Exception(
}
}
/**
* Returns the value of the issuer property.
*
* @return the value of the issuer property
* @see #setIssuer(Issuer)
*/
return issuer;
}
/**
* Sets the value of the issuer property.
*
* @param value the value of the issuer property to be set
* @throws SAML2Exception if the object is immutable
* @see #getIssuer
*/
throws SAML2Exception {
if (isMutable) {
} else {
throw new SAML2Exception(
}
}
/**
* Returns whether the <code>StatusResponse</code> is signed or not.
*
* @return true if the <code>StatusResponse</code> is signed.
*/
public boolean isSigned() {
return isSigned;
}
throws SAML2Exception {
if (isSignatureValid == null) {
}
return isSignatureValid.booleanValue();
}
/**
* Returns the <code>StatusResponse</code> in an XML document String format
* based on the <code>StatusResponse</code> schema described above.
*
* @return An XML String representing the <code>StatusResponse</code>.
* @throws SAML2Exception if some error occurs during conversion to
* <code>String</code>.
*/
return toXMLString(true,false);
}
/**
* Returns the <code>StatusResponse</code> in an XML document String format
* based on the <code>StatusResponse</code> schema described above.
*
* @param includeNSPrefix 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 XML String representing the <code>StatusResponse</code>.
* @throws SAML2Exception if some error occurs during conversion to
* <code>String</code>.
*/
boolean declareNS) throws SAML2Exception {
if (declareNS) {
}
}
}
}
}
}
if (extensions != null) {
}
}
}
/**
* Makes this object immutable.
*/
public void makeImmutable() {
if (isMutable) {
}
}
}
isMutable = false;
}
}
/**
* Returns true if object is mutable.
*
* @return true if object is mutable.
*/
public boolean isMutable() {
return isMutable;
}
/* Validates the responseId in the SAML Response. */
throw new SAML2Exception(
}
}
/* Validates the version in the SAML Response. */
"missingVersion"));
"incorrectVersion"));
}
}
/* Validates the IssueInstant attribute in the SAML Response. */
throws SAML2Exception {
throw new SAML2Exception(
} else {
try {
} catch (ParseException e) {
throw new SAML2Exception(
}
}
}
/* Validates the Status element in the SAML Response. */
protected void validateStatus()
throws SAML2Exception {
throw new SAML2Exception(
}
}
/* Validates the required elements in the SAML Response. */
protected void validateData() throws SAML2Exception {
if (issueInstant == null) {
throw new SAML2Exception(
}
}
}