Package com.sun.xml.wss.saml
Interface Assertion
-
- All Superinterfaces:
com.sun.xml.ws.security.Token
public interface Assertion extends com.sun.xml.ws.security.TokenThis interface stands forAssertionelement. An Assertion is a package of information that supplies one or moreStatementmade by an issuer. There are three kinds of assertions Authentication, Authorization Decision and Attribute assertion.<Assertion AssertionID="1124370015917" IssueInstant="2005-08-18T18:30:15.917+05:30" Issuer="CN=Assertion Issuer,OU=AI,O=Assertion Issuer,L=Waltham,ST=MA,C=US" MajorVersion="1" MinorVersion="1" xmlns="urn:oasis:names:tc:SAML:1.0:assertion"> <Conditions NotBefore="2005-08-16T13:21:50.503+05:30" NotOnOrAfter="2005-08-16T15:21:50.504+05:30"/> <Subject xmlns="urn:oasis:names:tc:SAML:1.0:assertion"> <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> <SubjectConfirmation> <ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:sender-vouches</ConfirmationMethod> </SubjectConfirmation> </Subject> <Attribute AttributeName="attribute1" AttributeNamespace="urn:com:sun:xml:wss:attribute"> <AttributeValue>ATTRIBUTE1</AttributeValue> </Attribute> <Assertion>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description AdvicegetAdvice()Gets the value of the advice property of SAMLStringgetAssertionID()Get the SAML Assertion ID for SAML1.0 and SAML1.1ConditionsgetConditions()Gets the value of the conditions property of SAMLStringgetID()Get the SAML Assertion ID for SAML2.0StringgetIssueInstance()Gets the value of the issueInstant property.BigIntegergetMajorVersion()Get the SAML Major Vertion for SAML1.0 and SAML1.1BigIntegergetMinorVersion()Get the SAML Minor Vertion for SAML1.0 and SAML1.1StringgetSamlIssuer()Get the issuer of SAML AssertionList<Object>getStatements()Return all statements presents in the SAML Assertion.SubjectgetSubject()Gets the value of the subject property of SAML 2.0 This method should be applied only on SAML 2.0 assertion.StringgetVersion()Get the SAML Vertion SAML2.0voidsetMajorVersion(BigInteger value)Deprecated.Set the saml major version for SAML1.0 and SAML1.1voidsetMinorVersion(BigInteger value)Deprecated.Set the saml minor version for SAML1.0 and SAML1.1voidsetVersion(String version)Deprecated.Set the saml version for SAML2.0Elementsign(X509Certificate cert, PrivateKey privKey)Sign the SAML Assertion - Enveloped SignatureElementsign(X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert)Sign the SAML Assertion - Enveloped SignatureElementsign(X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert, String signatureMethod, String canonicalizationMethod)Sign the SAML Assertion - Enveloped SignatureElementsign(PublicKey pubKey, PrivateKey privKey)Sign the SAML Assertion - Enveloped SignatureElementsign(DigestMethod digestMethod, String signatureMethod, X509Certificate cert, PrivateKey privKey)Sign the SAML Assertion - Enveloped SignatureElementsign(DigestMethod digestMethod, String signatureMethod, X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert)Sign the SAML Assertion - Enveloped SignatureElementsign(DigestMethod digestMethod, String signatureMethod, PublicKey pubKey, PrivateKey privKey)Sign the SAML Assertion - Enveloped SignatureElementtoElement(Node doc)Convert SAML Assertion toorg.w3c.dom.ElementbooleanverifySignature(PublicKey pubKey)Verify the SAML signature with the Public Key
-
-
-
Method Detail
-
sign
Element sign(PublicKey pubKey, PrivateKey privKey) throws SAMLException
Sign the SAML Assertion - Enveloped Signature- Parameters:
pubKey- Ajava.security.PublicKeyrepresenting the public key 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
Element sign(X509Certificate cert, PrivateKey privKey) throws SAMLException
Sign the SAML Assertion - Enveloped Signature- 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
Element sign(X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert) throws SAMLException
Sign the SAML Assertion - Enveloped Signature- 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
Element sign(X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert, String signatureMethod, String canonicalizationMethod) throws SAMLException
Sign the SAML Assertion - Enveloped Signature- 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.signatureMethod- Ajavax.xml.crypto.dsig.SignatureMethodrepresenting the signature algorithm used SAML signature.canonicalizationMethod- 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
Element sign(DigestMethod digestMethod, String signatureMethod, PublicKey pubKey, PrivateKey privKey) throws SAMLException
Sign the SAML Assertion - Enveloped Signature- 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.pubKey- Ajava.security.PublicKeyrepresenting the public key 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
Element sign(DigestMethod digestMethod, String signatureMethod, X509Certificate cert, PrivateKey privKey) throws SAMLException
Sign the SAML Assertion - Enveloped Signature- 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
-
sign
Element sign(DigestMethod digestMethod, String signatureMethod, X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert) throws SAMLException
Sign the SAML Assertion - Enveloped Signature- 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
-
setMajorVersion
void setMajorVersion(BigInteger value)
Deprecated.Set the saml major version for SAML1.0 and SAML1.1- Parameters:
value- Ajava.math.BigIntegerrepresenting saml major version.
-
setMinorVersion
void setMinorVersion(BigInteger value)
Deprecated.Set the saml minor version for SAML1.0 and SAML1.1- Parameters:
value- Ajava.math.BigIntegerrepresenting saml minor version.
-
setVersion
void setVersion(String version)
Deprecated.Set the saml version for SAML2.0- Parameters:
version- Ajava.lang.Stringrepresenting saml version
-
toElement
Element toElement(Node doc) throws com.sun.xml.wss.XWSSecurityException
Convert SAML Assertion toorg.w3c.dom.Element- Parameters:
doc- the contextorg.w3c.dom.Nodefor the creation of the resultingorg.w3c.dom.Element.- Returns:
- org.w3c.dom.Element element representation of SAML Assertion
- Throws:
com.sun.xml.wss.XWSSecurityException
-
getSamlIssuer
String getSamlIssuer()
Get the issuer of SAML Assertion- Returns:
- An
java.lang.Stringrepresenting saml issuer.
-
getAssertionID
String getAssertionID()
Get the SAML Assertion ID for SAML1.0 and SAML1.1- Returns:
- An
java.lang.Stringrepresenting saml assertion ID.
-
getID
String getID()
Get the SAML Assertion ID for SAML2.0- Returns:
- An
java.lang.Stringrepresenting saml assertion ID.
-
getVersion
String getVersion()
Get the SAML Vertion SAML2.0- Returns:
- An
java.lang.Stringrepresenting saml version.
-
getMajorVersion
BigInteger getMajorVersion()
Get the SAML Major Vertion for SAML1.0 and SAML1.1- Returns:
- An
java.math.BigIntegerrepresenting saml major version.
-
getMinorVersion
BigInteger getMinorVersion()
Get the SAML Minor Vertion for SAML1.0 and SAML1.1- Returns:
- An
java.math.BigIntegerrepresenting saml minor version.
-
getIssueInstance
String getIssueInstance()
Gets the value of the issueInstant property.- Returns:
- A
Stringrepresenting the issue timestamp of the SAML Assertion
-
getStatements
List<Object> getStatements()
Return all statements presents in the SAML Assertion.- Returns:
- An
java.util.Listof java.lang.Object representing all statements present inside the SAML assertion.
-
getConditions
Conditions getConditions()
Gets the value of the conditions property of SAML- Returns:
- A
Conditionsrepresenting conditions of the SAML Assertion.
-
getAdvice
Advice getAdvice()
Gets the value of the advice property of SAML- Returns:
- An
Advicerepresenting Advice element present in the SAML Assertion.
-
getSubject
Subject getSubject()
Gets 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.- Returns:
- A
Subjectrepresenting Subject of SAML 2.0
-
verifySignature
boolean verifySignature(PublicKey pubKey) throws SAMLException
Verify the SAML signature with the Public Key- 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
-
-