/** * 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 * https://opensso.dev.java.net/public/CDDLv1.0.html or * opensso/legal/CDDLv1.0.txt * 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: RequestAbstract.java,v 1.2 2008/06/25 05:47:57 qcheng Exp $ * * Portions Copyrighted 2015 ForgeRock AS. */ package com.sun.identity.saml2.protocol; import com.sun.identity.saml.xmlsig.XMLSignatureException; import com.sun.identity.saml2.assertion.Issuer; import com.sun.identity.saml2.common.SAML2Exception; import java.security.PublicKey; import java.security.PrivateKey; import java.security.cert.X509Certificate; import java.security.Signature; import com.sun.identity.saml2.xmlsig.SigManager; import java.util.Date; import java.util.Set; import org.w3c.dom.Element; /** * This interface defines methods for setting and retrieving attributes and * elements associated with a SAML request message used in SAML protocols. * * @supported.all.api */ public interface RequestAbstract { /** * Sets the Issuer object. * * @param nameID the new Issuer object. * @throws SAML2Exception if the object is immutable. * @see #getIssuer */ public void setIssuer(Issuer nameID) throws SAML2Exception; /** * Returns the Issuer Object. * * @return the Issuer object. * @see #setIssuer(Issuer) */ public com.sun.identity.saml2.assertion.Issuer getIssuer(); /** * Returns the Signature Object as a string. * * @return the Signature object as a string. */ public String getSignature(); /** * Signs the Request. * * @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. */ public void sign(PrivateKey privateKey, X509Certificate cert) throws SAML2Exception; /** * Sets the Extensions Object. * * @param extensions the Extensions object. * @throws SAML2Exception if the object is immutable. * @see #getExtensions */ public void setExtensions(Extensions extensions) throws SAML2Exception; /** * Returns the Extensions Object. * * @return the Extensions object. * @see #setExtensions(Extensions) */ public Extensions getExtensions(); /** * Sets the value of the ID attribute. * * @param id the new value of ID attribute. * @throws SAML2Exception if the object is immutable. * @see #getID */ public void setID(String id) throws SAML2Exception; /** * Returns the value of the ID attribute. * * @return the value of ID attribute. * @see #setID(String) */ public String getID(); /** * Sets the value of the Version attribute. * * @param version the value of Version attribute. * @throws SAML2Exception if the object is immutable. * @see #getVersion */ public void setVersion(String version) throws SAML2Exception; /** * Returns the value of the Version attribute. * * @return value of Version attribute. * @see #setVersion(String) */ String getVersion(); /** * Sets the value of IssueInstant attribute. * * @param dateTime new value of the IssueInstant attribute. * @throws SAML2Exception if the object is immutable. * @see #getIssueInstant */ public void setIssueInstant(Date dateTime) throws SAML2Exception; /** * Returns the value of IssueInstant attribute. * * @return value of the IssueInstant attribute. * @see #setIssueInstant(Date) */ public java.util.Date getIssueInstant(); /** * Sets the value of the Destination attribute. * * @param destinationURI new value of Destination attribute. * @throws SAML2Exception if the object is immutable. * @see #getDestination */ public void setDestination(String destinationURI) throws SAML2Exception; /** * Returns the value of the Destination attribute. * * @return the value of Destination attribute. * @see #setDestination(String) */ public String getDestination(); /** * Sets the value of the Consent attribute. * * @param consent new value of Consent attribute. * @throws SAML2Exception if the object is immutable. * @see #getConsent */ public void setConsent(String consent) throws SAML2Exception; /** * Returns the value of the Consent attribute. * * @return value of Consent attribute. * @see #setConsent(String) */ public String getConsent(); /** * Returns true if message is signed. * * @return true if message is signed. */ public boolean isSigned(); /** * Return whether the signature is valid or not. * * @param verificationCerts Certificates containing the public keys which may be used for signature verification; * This certificate may also may be used to check against the certificate included in the * signature. * @return true if the signature is valid; false otherwise. * @throws SAML2Exception if the signature could not be verified */ public boolean isSignatureValid(Set verificationCerts) throws SAML2Exception; /** * Returns a String representation of this Object. * * @return a String representation of this Object. * @throws SAML2Exception if it could not create String object */ public String toXMLString() throws SAML2Exception; /** * Returns a String representation of this Object. * * @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. * @throws SAML2Exception if it could not create String object. * @return a String representation of this Object. **/ public String toXMLString(boolean includeNSPrefix,boolean declareNS) throws SAML2Exception; /** * Makes this object immutable. */ public void makeImmutable() ; /** * Returns true if object is mutable. * * @return true if object is mutable. */ public boolean isMutable(); }