Class Assertion
java.lang.Object
com.sun.xml.wss.saml.internal.saml11.jaxb20.AssertionType
com.sun.xml.wss.saml.assertion.saml11.jaxb20.Assertion
- All Implemented Interfaces:
com.sun.xml.ws.security.Token,Assertion
This object stands for
Assertion element. An Assertion is a package
of information that supplies one or more Statement made by an
issuer. There are three kinds of assertions Au
[java] <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
[java] <Conditions NotBefore="2005-08-16T13:21:50.503+05:30" NotOnOrAfter="2005-08-16T15:21:50.504+05:30" xmlns="urn:oasis:names:tc:SAML:1.0:assertion"/>
[java] <Subject xmlns="urn:oasis:names:tc:SAML:1.0:assertion">
[java] <NameIdentifier Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName">CN=SAML User,OU=SU,O=SAML
User,L=Los Angeles,ST=CA,C=US</NameIdentifier>
[java] <SubjectConfirmation>
[java] <ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:sender-vouches</ConfirmationMethod>
[java] </SubjectConfirmation>
[java] </Subject>
[java] <Attribute AttributeName="attribute1" AttributeNamespace="urn:com:sun:xml:wss:attribute" xmlns="urn:oasis:names:tc:SAML:1.0:assertion">
[java] <AttributeValue>ATTRIBUTE1</AttributeValue>
[java] </Attribute>
thentication, Authorization
Decision and Attribute assertion.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Loggerstatic final StringXML Information Set REC all namespace attributes (including those named xmlns, whose [prefix] property has no value) have a namespace URI of http://www.w3.org/2000/xmlns/Fields inherited from class com.sun.xml.wss.saml.internal.saml11.jaxb20.AssertionType
advice, assertionID, conditions, issueInstant, issuer, majorVersion, minorVersion, signature, statementOrSubjectStatementOrAuthenticationStatement -
Constructor Summary
ConstructorsConstructorDescriptionAssertion(AssertionType assertion) Assertion(String assertionID, String issuer, GregorianCalendar issueInstant, Conditions conditions, Advice advice, List statements) This constructor is used to populate the data members: theassertionID, the issuer, time when assertion issued, the conditions when creating a new assertion ,Adviceapplicable to thisAssertionand a set ofStatement(s) in the assertion.Assertion(String assertionID, String issuer, GregorianCalendar issueInstant, Conditions conditions, Advice advice, List statements, javax.xml.bind.JAXBContext jcc) This constructor is used to populate the data members: theassertionID, the issuer, time when assertion issued, the conditions when creating a new assertion ,Adviceapplicable to thisAssertion,a set ofStatement(s) and a JAXBContext for the assertion. -
Method Summary
Modifier and TypeMethodDescriptionstatic AssertionfromElement(Element element) This constructor is used to buildAssertionobject from a block of existing XML that has already been built into a DOM.Gets the value of the advice property.Gets the value of the conditions property.getID()Get the SAML Assertion ID for SAML2.0Gets the value of the issueInstant property.Get the issuer of SAML AssertionReturn all statements presents in the SAML Assertion.Gets the value of the subject property of SAML 2.0 This method should be applied only on SAML 2.0 assertion.getType()Get the SAML Vertion SAML2.0booleanisSigned()voidsetVersion(String version) sign(X509Certificate cert, PrivateKey privKey) Sign the SAML Assertion - Enveloped Signaturesign(X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert) Sign the SAML Assertion - Enveloped Signaturesign(X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert, String sigAlgorithm, String canonicalizationAlgorithm) Sign the SAML Assertion - Enveloped Signaturesign(PublicKey pubKey, PrivateKey privKey) sign the saml assertion (Enveloped Signature)sign(DigestMethod digestMethod, String signatureMethod, X509Certificate cert, PrivateKey privKey) Sign the SAML Assertion - Enveloped Signaturesign(DigestMethod digestMethod, String signatureMethod, X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert) Sign the SAML Assertion - Enveloped Signaturesign(DigestMethod digestMethod, String signatureMethod, PublicKey pubKey, PrivateKey privKey) sign the saml assertion (Enveloped Signature)Convert SAML Assertion toorg.w3c.dom.ElementbooleanverifySignature(PublicKey pubKey) Verify the SAML signature with the Public KeyMethods inherited from class com.sun.xml.wss.saml.internal.saml11.jaxb20.AssertionType
getAssertionID, getIssueInstant, getIssuer, getMajorVersion, getMinorVersion, getSignature, getStatementOrSubjectStatementOrAuthenticationStatement, setAdvice, setAssertionID, setConditions, setIssueInstant, setIssuer, setMajorVersion, setMinorVersion, setSignatureMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.sun.xml.wss.saml.Assertion
getAssertionID, getMajorVersion, getMinorVersion, setMajorVersion, setMinorVersion
-
Field Details
-
XMLNS_URI
XML Information Set REC all namespace attributes (including those named xmlns, whose [prefix] property has no value) have a namespace URI of http://www.w3.org/2000/xmlns/ -
log
-
-
Constructor Details
-
Assertion
-
Assertion
public Assertion(String assertionID, String issuer, GregorianCalendar issueInstant, Conditions conditions, Advice advice, List statements) throws SAMLException This constructor is used to populate the data members: theassertionID, the issuer, time when assertion issued, the conditions when creating a new assertion ,Adviceapplicable to thisAssertionand a set ofStatement(s) in the assertion.- Parameters:
assertionID-AssertionIDobject contained within thisAssertionif null its generated internally.issuer- The issuer of this assertion.issueInstant- Time instant of the issue. It has typedateTimewhich is built in to the W3C XML Schema Types specification. if null, current time is used.conditions-Conditionsunder which the thisAssertionis valid.advice-Adviceapplicable for thisAssertion.statements- List ofStatementobjects within thisAssertion. It could be of typeAuthenticationStatement,AuthorizationDecisionStatementandAttributeStatement. Each Assertion can have multiple type of statements in it.- Throws:
SAMLException- if there is an error in processing input.
-
Assertion
public Assertion(String assertionID, String issuer, GregorianCalendar issueInstant, Conditions conditions, Advice advice, List statements, javax.xml.bind.JAXBContext jcc) throws SAMLException This constructor is used to populate the data members: theassertionID, the issuer, time when assertion issued, the conditions when creating a new assertion ,Adviceapplicable to thisAssertion,a set ofStatement(s) and a JAXBContext for the assertion.- Parameters:
assertionID-AssertionIDobject contained within thisAssertionif null its generated internally.issuer- The issuer of this assertion.issueInstant- Time instant of the issue. It has typedateTimewhich is built in to the W3C XML Schema Types specification. if null, current time is used.conditions-Conditionsunder which the thisAssertionis valid.advice-Adviceapplicable for thisAssertion.statements- List ofStatementobjects within thisAssertion. It could be of typeAuthenticationStatement,AuthorizationDecisionStatementandAttributeStatement. Each Assertion can have multiple type of statements in it.jcc- JAXBContext to be used for marshaling and unmarshalling the asertions.- Throws:
SAMLException- if there is an error in processing input.
-
-
Method Details
-
getVersion
Description copied from interface:AssertionGet the SAML Vertion SAML2.0- Specified by:
getVersionin interfaceAssertion- Returns:
- An
java.lang.Stringrepresenting saml version.
-
setVersion
- Specified by:
setVersionin interfaceAssertion- Parameters:
version- Ajava.lang.Stringrepresenting saml version
-
getID
Description copied from interface:AssertionGet the SAML Assertion ID for SAML2.0 -
getSamlIssuer
Description copied from interface:AssertionGet the issuer of SAML Assertion- Specified by:
getSamlIssuerin interfaceAssertion- Returns:
- An
java.lang.Stringrepresenting saml issuer.
-
getIssueInstance
Description copied from interface:AssertionGets the value of the issueInstant property.- Specified by:
getIssueInstancein interfaceAssertion- Returns:
- A
Stringrepresenting the issue timestamp of the SAML Assertion
-
getConditions
Description copied from class:AssertionTypeGets the value of the conditions property.- Specified by:
getConditionsin interfaceAssertion- Overrides:
getConditionsin classAssertionType- Returns:
- possible object is
ConditionsType
-
getAdvice
Description copied from class:AssertionTypeGets the value of the advice property.- Specified by:
getAdvicein interfaceAssertion- Overrides:
getAdvicein classAssertionType- Returns:
- possible object is
AdviceType
-
getSubject
Description copied from interface:AssertionGets the value of the subject property of SAML 2.0 This method should be applied only on SAML 2.0 assertion. For SAML1.1 and SAML1.0, first get a list of statements of the SAML assertion by calling getStatements() on theAssertionobject, then call the getSubject() on each statement.- Specified by:
getSubjectin interfaceAssertion- Returns:
- A
Subjectrepresenting Subject of SAML 2.0
-
sign
sign the saml assertion (Enveloped Signature)- Specified by:
signin interfaceAssertion- Parameters:
pubKey- PublicKey to be used for Signature verificationprivKey- PrivateKey to be used for Signature calculation- Returns:
- An
org.w3c.dom.Elementrepresentation of Signed SAML Assertion - Throws:
SAMLException
-
sign
public Element sign(X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert) throws SAMLException Description copied from interface:AssertionSign the SAML Assertion - Enveloped Signature- Specified by:
signin interfaceAssertion- Parameters:
cert- Ajava.security.cert.X509Certificaterepresenting the certificate used for Signature verificationprivKey- Ajava.security.PrivateKeyrepresenting the private key used for Signature calculation.alwaysIncludeCert- A flag to tell whether to incude the certificate in the SAML signature. By Default DigestMethod.SHA1, SignatureMethod.RSA_SHA1 and CanonicalizationMethod.EXCLUSIVE will be used.- Returns:
- An
org.w3c.dom.Elementrepresentation of Signed SAML Assertion - Throws:
SAMLException
-
sign
public Element sign(X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert, String sigAlgorithm, String canonicalizationAlgorithm) throws SAMLException Description copied from interface:AssertionSign the SAML Assertion - Enveloped Signature- Specified by:
signin interfaceAssertion- Parameters:
cert- Ajava.security.cert.X509Certificaterepresenting the certificate used for Signature verificationprivKey- Ajava.security.PrivateKeyrepresenting the private key used for Signature calculation.alwaysIncludeCert- A flag to tell whether to incude the certificate in the SAML signature.sigAlgorithm- Ajavax.xml.crypto.dsig.SignatureMethodrepresenting the signature algorithm used SAML signature.canonicalizationAlgorithm- Ajavax.xml.crypto.dsig.CanonicalizationMethodrepresenting the canonicalization algorithm used SAML signature. By Default DigestMethod.SHA1, SignatureMethod.RSA_SHA1 and CanonicalizationMethod.EXCLUSIVE will be used.- Returns:
- An
org.w3c.dom.Elementrepresentation of Signed SAML Assertion - Throws:
SAMLException
-
sign
Description copied from interface:AssertionSign the SAML Assertion - Enveloped Signature- Specified by:
signin interfaceAssertion- Parameters:
cert- Ajava.security.cert.X509Certificaterepresenting the certificate used for Signature verificationprivKey- Ajava.security.PrivateKeyrepresenting the private key used for Signature calculation. By Default DigestMethod.SHA1, SignatureMethod.RSA_SHA1 and CanonicalizationMethod.EXCLUSIVE will be used.- Returns:
- An
org.w3c.dom.Elementrepresentation of Signed SAML Assertion - Throws:
SAMLException
-
sign
public Element sign(DigestMethod digestMethod, String signatureMethod, PublicKey pubKey, PrivateKey privKey) throws SAMLException sign the saml assertion (Enveloped Signature)- Specified by:
signin interfaceAssertion- Parameters:
digestMethod- DigestMethod to be usedsignatureMethod- SignatureMethod to be used.pubKey- PublicKey to be used for Signature verificationprivKey- PrivateKey to be used for Signature calculation- Returns:
- An
org.w3c.dom.Elementrepresentation of Signed SAML Assertion - Throws:
SAMLException
-
sign
public Element sign(DigestMethod digestMethod, String signatureMethod, X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert) throws SAMLException Description copied from interface:AssertionSign the SAML Assertion - Enveloped Signature- Specified by:
signin interfaceAssertion- Parameters:
digestMethod- Ajavax.xml.crypto.dsig.DigestMethodrepresenting the digest method used for SAML signature.signatureMethod- Ajavax.xml.crypto.dsig.SignatureMethodrepresenting the signature algorithm used SAML signature.cert- Ajava.security.cert.X509Certificaterepresenting the certificate used for Signature verificationprivKey- Ajava.security.PrivateKeyrepresenting the private key used for Signature calculation.alwaysIncludeCert- A flag to tell whether to incude the certificate in the SAML signature. By Default DigestMethod.SHA1, SignatureMethod.RSA_SHA1 and CanonicalizationMethod.EXCLUSIVE will be used.- Returns:
- An
org.w3c.dom.Elementrepresentation of Signed SAML Assertion - Throws:
SAMLException
-
sign
public Element sign(DigestMethod digestMethod, String signatureMethod, X509Certificate cert, PrivateKey privKey) throws SAMLException Description copied from interface:AssertionSign the SAML Assertion - Enveloped Signature- Specified by:
signin interfaceAssertion- Parameters:
digestMethod- Ajavax.xml.crypto.dsig.DigestMethodrepresenting the digest method used for SAML signature.signatureMethod- Ajavax.xml.crypto.dsig.SignatureMethodrepresenting the signature algorithm used SAML signature.cert- Ajava.security.cert.X509Certificaterepresenting the certificate used for Signature verificationprivKey- Ajava.security.PrivateKeyrepresenting the private key used for Signature calculation. By Default DigestMethod.SHA1, SignatureMethod.RSA_SHA1 and CanonicalizationMethod.EXCLUSIVE will be used.- Returns:
- An
org.w3c.dom.Elementrepresentation of Signed SAML Assertion - Throws:
SAMLException
-
toElement
Description copied from interface:AssertionConvert SAML Assertion toorg.w3c.dom.Element -
isSigned
public boolean isSigned() -
fromElement
This constructor is used to buildAssertionobject from a block of existing XML that has already been built into a DOM.- Parameters:
element- Aorg.w3c.dom.Elementrepresenting DOM tree forAssertionobject- Throws:
SAMLException- if it could not process the Element properly, implying that there is an error in the sender or in the element definition.
-
getStatements
Description copied from interface:AssertionReturn all statements presents in the SAML Assertion.- Specified by:
getStatementsin interfaceAssertion- Returns:
- An
java.util.Listofjava.lang.Objectrepresenting all statements present inside the SAML assertion.
-
getType
- Specified by:
getTypein interfacecom.sun.xml.ws.security.Token
-
getTokenValue
- Specified by:
getTokenValuein interfacecom.sun.xml.ws.security.Token
-
verifySignature
Description copied from interface:AssertionVerify the SAML signature with the Public Key- Specified by:
verifySignaturein interfaceAssertion- Parameters:
pubKey- Ajava.security.PublicKeyrepresenting the public key used for Signature verification- Returns:
- An
Booleanrepresenting whether SAML signature verification is successful or not. - Throws:
SAMLException
-