AssertionArtifact.java revision a688bcbb4bcff5398fdd29b86f83450257dc0df4
/**
* 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: AssertionArtifact.java,v 1.2 2008/06/25 05:47:36 qcheng Exp $
*
*/
/**
* This class represents the <code>AssertionArtifact</code> element in
* SAML protocol schema. Current implementation supports TYPE 1 artifact only.
* Other type of artifact can be supported by extending this class.
*
* @supported.all.api
*/
public class AssertionArtifact {
/**
* This value specifies the assertion artifact as a string.
*/
final static int ARTIFACT_1_LENGTH = 42;
final static byte ARTIFACT_1_TYPE_CODE_0 = 0;
final static byte ARTIFACT_1_TYPE_CODE_1 = 1;
/**
* This is the default constructor of assertion artifact.
*/
protected AssertionArtifact() {
}
/**
* This constructor is used to construct an assertion artifact.
* @param theArtifact is the string that is generated by a provider.
* @exception SAMLException if an error occurs.
*/
// check if the input is empty
throw new SAMLRequesterException(
}
// decode the artifact
try {
} catch (Exception e) {
+ " input:", e);
}
throw new SAMLRequesterException(
}
// check if the length is 42bytes
}
throw new SAMLRequesterException(
}
// check if the typecode is correct
throw new SAMLRequesterException(
}
// get the sourceID and assertionHandle
try {
} catch (Exception e) {
}
}
/**
* This constructor will be used at the sender side to create a new
* <code>AssertionArtifact</code>.
*
* @param id A string that represents the <code>sourceID</code>.
* @param handle A string that represents the <code>assertionHandle</code>.
* @exception SAMLException if wrong input or could not encode the artifact.
*/
throw new SAMLRequesterException(
}
byte handleBytes[] = null;
try {
} catch (Exception e) {
}
throw new SAMLRequesterException(
}
byte raw[] = new byte[42];
}
try {
} catch (Exception e) {
+ " input:", e);
}
throw new SAMLRequesterException(
}
}
/**
* Gets the artifact.
* @return the string format of the artifact. It's base64 encoded.
*/
public String getAssertionArtifact() {
return artifact;
}
/**
* Returns the <code>SourceID</code> of the artifact.
*
* @return The <code>SourceID</code> of the artifact.
*/
public String getSourceID() {
return sourceID;
}
/**
* Gets the <code>AssertionHandle</code> of the artifact. The result will be
* decoded.
*
* @return The <code>AssertionHandle</code> of the artifact.
*/
public String getAssertionHandle() {
return assertionHandle;
}
/**
* Gets the <code>typeCode</code> of the artifact.
* @return The byte array of the <code>TypeCode</code> for the artifact.
*/
public byte[] getTypeCode() {
return typeCode;
}
/**
* Translates the <code>AssertionArtifact</code> to an XML document String
* based on the SAML schema.
* @return An XML String representing the <code>AssertionArtifact</code>.
*/
return toString(true, false);
}
/**
* Creates a String representation of the
* <code><samlp:AssertionArtifact></code> 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
*/
if (includeNS) {
}
if (declareNS) {
}
append("AssertionArtifact>\n");
}
}