Class RequestAbstractImpl
- java.lang.Object
-
- com.sun.identity.saml2.protocol.impl.RequestAbstractImpl
-
- All Implemented Interfaces:
RequestAbstract
- Direct Known Subclasses:
ArtifactResolveImpl,AssertionIDRequestImpl,AuthnRequestImpl,LogoutRequestImpl,ManageNameIDRequestImpl,NameIDMappingRequestImpl,SubjectQueryAbstractImpl,XACMLAuthzDecisionQueryImpl
public abstract class RequestAbstractImpl extends Object implements RequestAbstract
This abstract class defines methods for setting and retrieving attributes and elements associated with a SAML request message used in SAML protocols. This class is the base class for all SAML Requests.
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringconsentprotected StringdestinationURIprotected StringelementNameprotected Extensionsextensionsprotected booleanisMutableprotected BooleanisSignatureValidprotected booleanisSignedprotected DateissueInstantprotected IssuernameIDprotected PublicKeypublicKeyprotected StringrequestIdprotected StringsignatureStringprotected StringsignedXMLStringprotected Stringversion
-
Constructor Summary
Constructors Constructor Description RequestAbstractImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetAttributesString()StringgetConsent()Sets the value of theConsentattribute.StringgetDestination()Returns the value of theDestinationattribute.protected StringgetElements(boolean includeNSPrefix, boolean declareNS)ExtensionsgetExtensions()Returns theExtensionsObject.StringgetID()Returns the value of theIDattribute.DategetIssueInstant()Returns the value ofIssueInstantattribute.IssuergetIssuer()Returns theIssuerObject.StringgetSignature()Returns theSignatureObject as a string.StringgetVersion()Returns the value of theVersionattribute.protected voidgetXMLString(Set namespaces, StringBuffer attrs, StringBuffer childElements, boolean includeNSPrefix, boolean declareNS)booleanisMutable()Returns true if object is mutable.booleanisSignatureValid(Set<X509Certificate> verificationCerts)Return whether the signature is valid or not.booleanisSigned()Returns true if message is signed.voidmakeImmutable()Makes this object immutable.protected voidparseDOMAttributes(Element element)Parses attributes of the Docuemnt Element for this object.protected voidparseDOMChileElements(ListIterator iter)Parses child elements of the Docuemnt Element for this object.protected voidparseDOMElement(Element element)Parses the Docuemnt Element for this object.voidsetConsent(String consent)Sets the value of the Consent property.voidsetDestination(String destinationURI)Sets the value of theDestinationattribute.voidsetExtensions(Extensions extensions)Sets theExtensionsObject.voidsetID(String id)Sets the value of theIDattribute.voidsetIssueInstant(Date dateTime)Sets the value ofIssueInstantattribute.voidsetIssuer(Issuer nameID)Sets theIssuerobject.voidsetVersion(String version)Sets the value of theVersionattribute.voidsign(PrivateKey privateKey, X509Certificate cert)Signs the Request.StringtoXMLString()Returns a String representation of this Object.StringtoXMLString(boolean includeNSPrefix, boolean declareNS)Returns a String representation of this Object.protected voidvalidateData()protected voidvalidateID(String requestID)protected voidvalidateIssueInstant(String issueInstantStr)protected voidvalidateVersion(String version)
-
-
-
Field Detail
-
nameID
protected Issuer nameID
-
extensions
protected Extensions extensions
-
requestId
protected String requestId
-
version
protected String version
-
issueInstant
protected Date issueInstant
-
destinationURI
protected String destinationURI
-
consent
protected String consent
-
isSigned
protected boolean isSigned
-
isSignatureValid
protected Boolean isSignatureValid
-
publicKey
protected PublicKey publicKey
-
isMutable
protected boolean isMutable
-
signatureString
protected String signatureString
-
signedXMLString
protected String signedXMLString
-
elementName
protected String elementName
-
-
Method Detail
-
setIssuer
public void setIssuer(Issuer nameID) throws SAML2Exception
Sets theIssuerobject.- Specified by:
setIssuerin interfaceRequestAbstract- Parameters:
nameID- the newIssuerobject.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getIssuer()
-
getIssuer
public Issuer getIssuer()
Returns theIssuerObject.- Specified by:
getIssuerin interfaceRequestAbstract- Returns:
- the
Issuerobject. - See Also:
setIssuer(Issuer)
-
getSignature
public String getSignature()
Returns theSignatureObject as a string.- Specified by:
getSignaturein interfaceRequestAbstract- Returns:
- the
Signatureobject as a string.
-
sign
public void sign(PrivateKey privateKey, X509Certificate cert) throws SAML2Exception
Signs the Request.- Specified by:
signin interfaceRequestAbstract- Parameters:
privateKey- Signing keycert- 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.
-
setExtensions
public void setExtensions(Extensions extensions) throws SAML2Exception
Sets theExtensionsObject.- Specified by:
setExtensionsin interfaceRequestAbstract- Parameters:
extensions- theExtensionsobject.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getExtensions()
-
getExtensions
public Extensions getExtensions()
Returns theExtensionsObject.- Specified by:
getExtensionsin interfaceRequestAbstract- Returns:
- the
Extensionsobject. - See Also:
setExtensions(Extensions)
-
setID
public void setID(String id) throws SAML2Exception
Sets the value of theIDattribute.- Specified by:
setIDin interfaceRequestAbstract- Parameters:
id- the new value ofIDattribute.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getID()
-
getID
public String getID()
Returns the value of theIDattribute.- Specified by:
getIDin interfaceRequestAbstract- Returns:
- the value of
IDattribute. - See Also:
setID(String)
-
setVersion
public void setVersion(String version) throws SAML2Exception
Sets the value of theVersionattribute.- Specified by:
setVersionin interfaceRequestAbstract- Parameters:
version- the value ofVersionattribute.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getVersion()
-
getVersion
public String getVersion()
Returns the value of theVersionattribute.- Specified by:
getVersionin interfaceRequestAbstract- Returns:
- value of
Versionattribute. - See Also:
setVersion(String)
-
setIssueInstant
public void setIssueInstant(Date dateTime) throws SAML2Exception
Sets the value ofIssueInstantattribute.- Specified by:
setIssueInstantin interfaceRequestAbstract- Parameters:
dateTime- new value of theIssueInstantattribute.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getIssueInstant()
-
getIssueInstant
public Date getIssueInstant()
Returns the value ofIssueInstantattribute.- Specified by:
getIssueInstantin interfaceRequestAbstract- Returns:
- value of the
IssueInstantattribute. - See Also:
setIssueInstant(Date)
-
setDestination
public void setDestination(String destinationURI) throws SAML2Exception
Sets the value of theDestinationattribute.- Specified by:
setDestinationin interfaceRequestAbstract- Parameters:
destinationURI- new value ofDestinationattribute.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getDestination()
-
getDestination
public String getDestination()
Returns the value of theDestinationattribute.- Specified by:
getDestinationin interfaceRequestAbstract- Returns:
- the value of
Destinationattribute. - See Also:
setDestination(String)
-
setConsent
public void setConsent(String consent) throws SAML2Exception
Sets the value of the Consent property.- Specified by:
setConsentin interfaceRequestAbstract- Parameters:
consent- , value of Consent property.- Throws:
SAML2Exception- if the object is immutable.- See Also:
getConsent()
-
getConsent
public String getConsent()
Sets the value of theConsentattribute.- Specified by:
getConsentin interfaceRequestAbstract- Returns:
- the value of
Consentattribute. - Throws:
SAML2Exception- if the object is immutable.- See Also:
setConsent(String)
-
isSigned
public boolean isSigned()
Returns true if message is signed.- Specified by:
isSignedin interfaceRequestAbstract- Returns:
- true if message is signed.
-
isSignatureValid
public boolean isSignatureValid(Set<X509Certificate> verificationCerts) throws SAML2Exception
Description copied from interface:RequestAbstractReturn whether the signature is valid or not.- Specified by:
isSignatureValidin interfaceRequestAbstract- Parameters:
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.- Returns:
- true if the signature is valid; false otherwise.
- Throws:
SAML2Exception- if the signature could not be verified
-
toXMLString
public String toXMLString() throws SAML2Exception
Returns a String representation of this Object.- Specified by:
toXMLStringin interfaceRequestAbstract- Returns:
- a String representation of this Object.
- Throws:
SAML2Exception- if it could not create String object
-
toXMLString
public String toXMLString(boolean includeNSPrefix, boolean declareNS) throws SAML2Exception
Returns a String representation of this Object.- Specified by:
toXMLStringin interfaceRequestAbstract- Parameters:
includeNSPrefix- determines whether or not the namespace qualifier is prepended to the Element when converteddeclareNS- determines whether or not the namespace is declared within the Element.- Returns:
- a String representation of this Object.
- Throws:
SAML2Exception- if it could not create String object.
-
getAttributesString
protected String getAttributesString() throws SAML2Exception
- Throws:
SAML2Exception
-
getElements
protected String getElements(boolean includeNSPrefix, boolean declareNS) throws SAML2Exception
- Throws:
SAML2Exception
-
makeImmutable
public void makeImmutable()
Makes this object immutable.- Specified by:
makeImmutablein interfaceRequestAbstract
-
isMutable
public boolean isMutable()
Returns true if object is mutable.- Specified by:
isMutablein interfaceRequestAbstract- Returns:
- true if object is mutable.
-
validateID
protected void validateID(String requestID) throws SAML2Exception
- Throws:
SAML2Exception
-
validateVersion
protected void validateVersion(String version) throws SAML2Exception
- Throws:
SAML2Exception
-
validateIssueInstant
protected void validateIssueInstant(String issueInstantStr) throws SAML2Exception
- Throws:
SAML2Exception
-
validateData
protected void validateData() throws SAML2Exception- Throws:
SAML2Exception
-
getXMLString
protected void getXMLString(Set namespaces, StringBuffer attrs, StringBuffer childElements, boolean includeNSPrefix, boolean declareNS) throws SAML2Exception
- Throws:
SAML2Exception
-
parseDOMElement
protected void parseDOMElement(Element element) throws SAML2Exception
Parses the Docuemnt Element for this object.- Parameters:
element- the Document Element of this object.- Throws:
SAML2Exception- if error parsing the Document Element.
-
parseDOMAttributes
protected void parseDOMAttributes(Element element) throws SAML2Exception
Parses attributes of the Docuemnt Element for this object.- Parameters:
element- the Document Element of this object.- Throws:
SAML2Exception- if error parsing the Document Element.
-
parseDOMChileElements
protected void parseDOMChileElements(ListIterator iter) throws SAML2Exception
Parses child elements of the Docuemnt Element for this object.- Parameters:
iter- the child elements iterator.- Throws:
SAML2Exception- if error parsing the Document Element.
-
-