public class AssertionImpl extends Object implements Assertion
Assertion
element is a package of information
that supplies one or more Statement
made by an issuer.
There are three kinds of assertions: Authentication, Authorization Decision,
and Attribute assertions.Modifier and Type | Field and Description |
---|---|
static String |
ASSERTION_ADVICE |
static String |
ASSERTION_ATTRIBUTESTATEMENT |
static String |
ASSERTION_AUTHNSTATEMENT |
static String |
ASSERTION_AUTHZDECISIONSTATEMENT |
static String |
ASSERTION_CONDITIONS |
static String |
ASSERTION_ELEMENT |
static String |
ASSERTION_ID_ATTR |
static String |
ASSERTION_ISSUEINSTANT_ATTR |
static String |
ASSERTION_ISSUER |
static String |
ASSERTION_SIGNATURE |
static String |
ASSERTION_STATEMENT |
static String |
ASSERTION_SUBJECT |
static String |
ASSERTION_VERSION_ATTR |
static String |
XSI_TYPE_ATTR |
Constructor and Description |
---|
AssertionImpl()
Default constructor
|
AssertionImpl(Element element)
This constructor is used to build
Assertion object from a
block of existing XML that has already been built into a DOM. |
AssertionImpl(String xml)
This constructor is used to build
Assertion object from a
XML string. |
Modifier and Type | Method and Description |
---|---|
EncryptedAssertion |
encrypt(Key recipientPublicKey,
String dataEncAlgorithm,
int dataEncStrength,
String recipientEntityID)
Returns an
EncryptedAssertion object. |
Advice |
getAdvice()
Returns the advice of the assertion
|
List<AttributeStatement> |
getAttributeStatements()
Returns the attribute statements of the assertion
|
List<AuthnStatement> |
getAuthnStatements()
Returns the Authn statements of the assertion
|
List<AuthzDecisionStatement> |
getAuthzDecisionStatements()
Returns the
AuthzDecisionStatements of the assertion |
Conditions |
getConditions()
Returns the conditions of the assertion
|
String |
getID()
Returns the id of the assertion
|
Date |
getIssueInstant()
Returns the time when the assertion was issued
|
Issuer |
getIssuer()
Returns the issuer of the assertion
|
String |
getSignature()
Returns the signature of the assertion
|
List<Object> |
getStatements()
Returns the statements of the assertion
|
Subject |
getSubject()
Returns the subject of the assertion
|
String |
getVersion()
Returns the version number of the assertion.
|
boolean |
isMutable()
Returns true if the object is mutable
|
boolean |
isSignatureValid(Set<X509Certificate> verificationCerts)
Return whether the signature is valid or not.
|
boolean |
isSigned()
Return whether the assertion is signed
|
boolean |
isTimeValid()
Gets the validity of the assertion evaluating its conditions if
specified.
|
void |
makeImmutable()
Makes the object immutable
|
void |
setAdvice(Advice advice)
Sets the advice of the assertion
|
void |
setAttributeStatements(List<AttributeStatement> statements)
Sets the attribute statements of the assertion
|
void |
setAuthnStatements(List<AuthnStatement> statements)
Sets the
AuthnStatements of the assertion |
void |
setAuthzDecisionStatements(List<AuthzDecisionStatement> statements)
Sets the
AuthzDecisionStatements of the assertion |
void |
setConditions(Conditions conditions)
Sets the conditions of the assertion
|
void |
setID(String id)
Sets the id of the assertion
|
void |
setIssueInstant(Date issueInstant)
Set the time when the assertion was issued
|
void |
setIssuer(Issuer issuer)
Sets the issuer of the assertion
|
void |
setStatements(List<Object> statements)
Sets the statements of the assertion
|
void |
setSubject(Subject subject)
Sets the subject of the assertion
|
void |
setVersion(String version)
Sets the version number of the assertion.
|
void |
sign(PrivateKey privateKey,
X509Certificate cert)
Sign the Assertion.
|
String |
toXMLString()
Returns a String representation
|
String |
toXMLString(boolean includeNSPrefix,
boolean declareNS)
Returns a String representation
|
public static String ASSERTION_ELEMENT
public static String ASSERTION_VERSION_ATTR
public static String ASSERTION_ID_ATTR
public static String ASSERTION_ISSUEINSTANT_ATTR
public static String XSI_TYPE_ATTR
public static String ASSERTION_ISSUER
public static String ASSERTION_SIGNATURE
public static String ASSERTION_SUBJECT
public static String ASSERTION_CONDITIONS
public static String ASSERTION_ADVICE
public static String ASSERTION_STATEMENT
public static String ASSERTION_AUTHNSTATEMENT
public static String ASSERTION_AUTHZDECISIONSTATEMENT
public static String ASSERTION_ATTRIBUTESTATEMENT
public AssertionImpl()
public AssertionImpl(String xml) throws SAML2Exception
Assertion
object from a
XML string.xml
- A java.lang.String
representing
a Assertion
objectSAML2Exception
- if it could not process the XML stringpublic AssertionImpl(Element element) throws SAML2Exception
Assertion
object from a
block of existing XML that has already been built into a DOM.element
- A org.w3c.dom.Element
representing
DOM tree for Assertion
objectSAML2Exception
- if it could not process the Elementpublic String getVersion()
getVersion
in interface Assertion
public void setVersion(String version) throws SAML2Exception
setVersion
in interface Assertion
version
- the version number.SAML2Exception
- if the object is immutablepublic Date getIssueInstant()
getIssueInstant
in interface Assertion
public void setIssueInstant(Date issueInstant) throws SAML2Exception
setIssueInstant
in interface Assertion
issueInstant
- the issue time of the assertionSAML2Exception
- if the object is immutablepublic Subject getSubject()
getSubject
in interface Assertion
public void setSubject(Subject subject) throws SAML2Exception
setSubject
in interface Assertion
subject
- the subject of the assertionSAML2Exception
- if the object is immutablepublic Advice getAdvice()
public void setAdvice(Advice advice) throws SAML2Exception
setAdvice
in interface Assertion
advice
- the advice of the assertionSAML2Exception
- if the object is immutablepublic String getSignature()
getSignature
in interface Assertion
public Conditions getConditions()
getConditions
in interface Assertion
public void setConditions(Conditions conditions) throws SAML2Exception
setConditions
in interface Assertion
conditions
- the conditions of the assertionSAML2Exception
- if the object is immutablepublic String getID()
public void setID(String id) throws SAML2Exception
setID
in interface Assertion
id
- the id of the assertionSAML2Exception
- if the object is immutablepublic List<Object> getStatements()
getStatements
in interface Assertion
public List<AuthnStatement> getAuthnStatements()
getAuthnStatements
in interface Assertion
public List<AuthzDecisionStatement> getAuthzDecisionStatements()
AuthzDecisionStatements
of the assertiongetAuthzDecisionStatements
in interface Assertion
AuthzDecisionStatements
of the assertionpublic List<AttributeStatement> getAttributeStatements()
getAttributeStatements
in interface Assertion
public void setStatements(List<Object> statements) throws SAML2Exception
setStatements
in interface Assertion
statements
- the statements of the assertionSAML2Exception
- if the object is immutablepublic void setAuthnStatements(List<AuthnStatement> statements) throws SAML2Exception
AuthnStatements
of the assertionsetAuthnStatements
in interface Assertion
statements
- the AuthnStatements
of the assertionSAML2Exception
- if the object is immutablepublic void setAuthzDecisionStatements(List<AuthzDecisionStatement> statements) throws SAML2Exception
AuthzDecisionStatements
of the assertionsetAuthzDecisionStatements
in interface Assertion
statements
- the AuthzDecisionStatements
of
the assertionSAML2Exception
- if the object is immutablepublic void setAttributeStatements(List<AttributeStatement> statements) throws SAML2Exception
setAttributeStatements
in interface Assertion
statements
- the attribute statements of the assertionSAML2Exception
- if the object is immutablepublic Issuer getIssuer()
public void setIssuer(Issuer issuer) throws SAML2Exception
setIssuer
in interface Assertion
issuer
- the issuer of the assertionSAML2Exception
- if the object is immutablepublic boolean isSigned()
public boolean isSignatureValid(Set<X509Certificate> verificationCerts) throws SAML2Exception
Assertion
isSignatureValid
in interface Assertion
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.SAML2Exception
- if the signature could not be verifiedpublic void sign(PrivateKey privateKey, X509Certificate cert) throws SAML2Exception
sign
in interface Assertion
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 certificateSAML2Exception
- if it could not sign the assertion.public EncryptedAssertion encrypt(Key recipientPublicKey, String dataEncAlgorithm, int dataEncStrength, String recipientEntityID) throws SAML2Exception
EncryptedAssertion
object.encrypt
in interface Assertion
recipientPublicKey
- Public key used to encrypt the data encryption
(secret) key, it is the public key of the
recipient of the XML document to be encrypted.dataEncAlgorithm
- Data encryption algorithm.dataEncStrength
- Data encryption strength.recipientEntityID
- Unique identifier of the recipient, it is used
as the index to the cached secret key so that
the key can be reused for the same recipient;
It can be null in which case the secret key will
be generated every time and will not be cached
and reused. Note that the generation of a secret
key is a relatively expensive operation.EncryptedAssertion
objectSAML2Exception
- if error occurs during the encryption process.public boolean isTimeValid()
isTimeValid
in interface Assertion
NotBefore
(current time inclusive) and
NotOnOrAfter
(current time exclusive) values
and true otherwise or if no conditions specified.public String toXMLString(boolean includeNSPrefix, boolean declareNS) throws SAML2Exception
toXMLString
in interface Assertion
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.SAML2Exception
- if something is wrong during conversionpublic String toXMLString() throws SAML2Exception
toXMLString
in interface Assertion
SAML2Exception
- if something is wrong during conversionpublic void makeImmutable()
makeImmutable
in interface Assertion
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.