com.sun.xml.wss.saml.assertion.saml11.jaxb10
Class Assertion

java.lang.Object
  extended by com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionTypeImpl
      extended by com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionImpl
          extended by com.sun.xml.wss.saml.assertion.saml11.jaxb10.Assertion
All Implemented Interfaces:
com.sun.xml.bind.JAXBObject, com.sun.xml.bind.marshaller.IdentifiableObject, com.sun.xml.bind.RIElement, Token, com.sun.xml.wss.saml.internal.saml11.jaxb10.Assertion, com.sun.xml.wss.saml.internal.saml11.jaxb10.AssertionType, com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.runtime.UnmarshallableObject, com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.runtime.ValidatableObject, com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.runtime.XMLSerializable, Element

public class Assertion
extends com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionImpl
implements 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] [java] [java] [java] CN=SAML User,OU=SU,O=SAML User,L=Los Angeles,ST=CA,C=US [java] [java] urn:oasis:names:tc:SAML:1.0:cm:sender-vouches [java] [java] [java] [java] ATTRIBUTE1 [java] thentication, Authorization Decision and Attribute assertion.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionImpl
com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionImpl.Unmarshaller
 
Field Summary
protected static Logger log
           
 
Fields inherited from class com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionTypeImpl
_Advice, _AssertionID, _Conditions, _IssueInstant, _Issuer, _MajorVersion, _MinorVersion, _Signature, _StatementOrSubjectStatementOrAuthenticationStatement
 
Constructor Summary
Assertion(com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionImpl assertion)
           
Assertion(String assertionID, String issuer, Calendar issueInstant, Conditions conditions, Advice advice, List statements)
          This constructor is used to populate the data members: the assertionID, the issuer, time when assertion issued, the conditions when creating a new assertion , Advice applicable to this Assertion and a set of Statement(s) in the assertion.
Assertion(String assertionID, String issuer, Calendar issueInstant, Conditions conditions, Advice advice, List statements, JAXBContext jcc)
          This constructor is used to populate the data members: the assertionID, the issuer, time when assertion issued, the conditions when creating a new assertion , Advice applicable to this Assertion , a set of Statement(s) and a JAXBContext for the assertion.
 
Method Summary
static Assertion fromElement(Element element)
          This constructor is used to build Assertion object from a block of existing XML that has already been built into a DOM.
 Advice getAdvice()
          Gets the value of the advice property of SAML
 Conditions getConditions()
          Gets the value of the conditions property of SAML
 String getID()
          Get the SAML Assertion ID for SAML2.0
 String getIssueInstance()
          Gets the value of the issueInstant property.
 String getSamlIssuer()
          Get the issuer of SAML Assertion
 List<Object> getStatements()
          Return all statements presents in the SAML Assertion.
 Subject getSubject()
          Gets the value of the subject property of SAML 2.0 This method should be applied only on SAML 2.0 assertion.
 Object getTokenValue()
          The token Value
 String getType()
          The type of the Token
 String getVersion()
          Get the SAML Vertion SAML2.0
 boolean isSigned()
           
 void setVersion(String version)
           
 Element sign(DigestMethod digestMethod, String signatureMethod, PublicKey pubKey, PrivateKey privKey)
          sign the saml assertion (Enveloped Signature)
 Element sign(DigestMethod digestMethod, String signatureMethod, X509Certificate cert, PrivateKey privKey)
          Sign the SAML Assertion - Enveloped Signature
 Element sign(DigestMethod digestMethod, String signatureMethod, X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert)
          Sign the SAML Assertion - Enveloped Signature
 Element sign(PublicKey pubKey, PrivateKey privKey)
          sign the saml assertion (Enveloped Signature)
 Element sign(X509Certificate cert, PrivateKey privKey)
          Sign the SAML Assertion - Enveloped Signature
 Element sign(X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert)
          Sign the SAML Assertion - Enveloped Signature
 Element sign(X509Certificate cert, PrivateKey privKey, boolean alwaysIncludeCert, String sigAlgorithm, String canonicalizationAlgorithm)
          Sign the SAML Assertion - Enveloped Signature
 Element toElement(Node doc)
          Convert SAML Assertion to org.w3c.dom.Element
 boolean verifySignature(PublicKey pubKey)
          Verify the SAML signature with the Public Key
 
Methods inherited from class com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionImpl
____jaxb_ri____getLocalName, ____jaxb_ri____getNamespaceURI, createRawValidator, createUnmarshaller, getPrimaryInterface, serializeAttributes, serializeBody, serializeURIs
 
Methods inherited from class com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionTypeImpl
____jaxb____getId, _getStatementOrSubjectStatementOrAuthenticationStatement, getAssertionID, getIssueInstant, getIssuer, getMajorVersion, getMinorVersion, getSignature, getStatementOrSubjectStatementOrAuthenticationStatement, setAdvice, setAssertionID, setConditions, setIssueInstant, setIssuer, setMajorVersion, setMinorVersion, setSignature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.xml.wss.saml.Assertion
getAssertionID, getMajorVersion, getMinorVersion, setMajorVersion, setMinorVersion
 
Methods inherited from interface com.sun.xml.wss.saml.internal.saml11.jaxb10.AssertionType
getAssertionID, getIssueInstant, getIssuer, getMajorVersion, getMinorVersion, getSignature, getStatementOrSubjectStatementOrAuthenticationStatement, setAdvice, setAssertionID, setConditions, setIssueInstant, setIssuer, setMajorVersion, setMinorVersion, setSignature
 

Field Detail

log

protected static final Logger log
Constructor Detail

Assertion

public Assertion(com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionImpl assertion)

Assertion

public Assertion(String assertionID,
                 String issuer,
                 Calendar issueInstant,
                 Conditions conditions,
                 Advice advice,
                 List statements)
          throws SAMLException
This constructor is used to populate the data members: the assertionID, the issuer, time when assertion issued, the conditions when creating a new assertion , Advice applicable to this Assertion and a set of Statement(s) in the assertion.

Parameters:
assertionID - AssertionID object contained within this Assertion if null its generated internally.
issuer - The issuer of this assertion.
issueInstant - Time instant of the issue. It has type dateTime which is built in to the W3C XML Schema Types specification. if null, current time is used.
conditions - Conditions under which the this Assertion is valid.
advice - Advice applicable for this Assertion.
statements - List of Statement objects within this Assertion. It could be of type AuthenticationStatement, AuthorizationDecisionStatement and AttributeStatement. 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,
                 Calendar issueInstant,
                 Conditions conditions,
                 Advice advice,
                 List statements,
                 JAXBContext jcc)
          throws SAMLException
This constructor is used to populate the data members: the assertionID, the issuer, time when assertion issued, the conditions when creating a new assertion , Advice applicable to this Assertion , a set of Statement(s) and a JAXBContext for the assertion.

Parameters:
assertionID - AssertionID object contained within this Assertion if null its generated internally.
issuer - The issuer of this assertion.
issueInstant - Time instant of the issue. It has type dateTime which is built in to the W3C XML Schema Types specification. if null, current time is used.
conditions - Conditions under which the this Assertion is valid.
advice - Advice applicable for this Assertion.
statements - List of Statement objects within this Assertion. It could be of type AuthenticationStatement, AuthorizationDecisionStatement and AttributeStatement. Each Assertion can have multiple type of statements in it.
jcc - JAXBContext to be used for marshaling and unmarshalling the assertions.
Throws:
SAMLException - if there is an error in processing input.
Method Detail

getVersion

public String getVersion()
Description copied from interface: Assertion
Get the SAML Vertion SAML2.0

Returns:
An java.lang.String representing saml version.

setVersion

public void setVersion(String version)
Parameters:
version - A java.lang.String representing saml version

getID

public String getID()
Description copied from interface: Assertion
Get the SAML Assertion ID for SAML2.0

Returns:
An java.lang.String representing saml assertion ID.

getSamlIssuer

public String getSamlIssuer()
Description copied from interface: Assertion
Get the issuer of SAML Assertion

Returns:
An java.lang.String representing saml issuer.

getIssueInstance

public String getIssueInstance()
Description copied from interface: Assertion
Gets the value of the issueInstant property.

Returns:
A String representing the issue timestamp of the SAML Assertion

getConditions

public Conditions getConditions()
Description copied from interface: Assertion
Gets the value of the conditions property of SAML

Specified by:
getConditions in interface com.sun.xml.wss.saml.internal.saml11.jaxb10.AssertionType
Overrides:
getConditions in class com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionTypeImpl
Returns:
A Conditions representing conditions of the SAML Assertion.

getAdvice

public Advice getAdvice()
Description copied from interface: Assertion
Gets the value of the advice property of SAML

Specified by:
getAdvice in interface com.sun.xml.wss.saml.internal.saml11.jaxb10.AssertionType
Overrides:
getAdvice in class com.sun.xml.wss.saml.internal.saml11.jaxb10.impl.AssertionTypeImpl
Returns:
An Advice representing Advice element present in the SAML Assertion.

getSubject

public Subject getSubject()
Description copied from interface: Assertion
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 the Assertion object, then call the getSubject() on each statement.

Returns:
A Subject representing Subject of SAML 2.0

sign

public Element sign(PublicKey pubKey,
                    PrivateKey privKey)
             throws SAMLException
sign the saml assertion (Enveloped Signature)

Parameters:
pubKey - PublicKey to be used for Signature verification
privKey - PrivateKey to be used for Signature calculation
Returns:
An org.w3c.dom.Element representation of Signed SAML Assertion
Throws:
SAMLException

sign

public Element sign(X509Certificate cert,
                    PrivateKey privKey,
                    boolean alwaysIncludeCert)
             throws SAMLException
Description copied from interface: Assertion
Sign the SAML Assertion - Enveloped Signature

Parameters:
cert - A java.security.cert.X509Certificate representing the certificate used for Signature verification
privKey - A java.security.PrivateKey representing 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.Element representation 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: Assertion
Sign the SAML Assertion - Enveloped Signature

Parameters:
cert - A java.security.cert.X509Certificate representing the certificate used for Signature verification
privKey - A java.security.PrivateKey representing the private key used for Signature calculation.
alwaysIncludeCert - A flag to tell whether to incude the certificate in the SAML signature.
sigAlgorithm - A javax.xml.crypto.dsig.SignatureMethod representing the signature algorithm used SAML signature.
canonicalizationAlgorithm - A javax.xml.crypto.dsig.CanonicalizationMethod representing the canonicalization algorithm used SAML signature. By Default DigestMethod.SHA1, SignatureMethod.RSA_SHA1 and CanonicalizationMethod.EXCLUSIVE will be used.
Returns:
An org.w3c.dom.Element representation of Signed SAML Assertion
Throws:
SAMLException

sign

public Element sign(X509Certificate cert,
                    PrivateKey privKey)
             throws SAMLException
Description copied from interface: Assertion
Sign the SAML Assertion - Enveloped Signature

Parameters:
cert - A java.security.cert.X509Certificate representing the certificate used for Signature verification
privKey - A java.security.PrivateKey representing 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.Element representation 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)

Parameters:
digestMethod - DigestMethod to be used
signatureMethod - SignatureMethod to be used.
pubKey - PublicKey to be used for Signature verification
privKey - PrivateKey to be used for Signature calculation
Returns:
An org.w3c.dom.Element representation 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: Assertion
Sign the SAML Assertion - Enveloped Signature

Parameters:
digestMethod - A javax.xml.crypto.dsig.DigestMethod representing the digest method used for SAML signature.
signatureMethod - A javax.xml.crypto.dsig.SignatureMethod representing the signature algorithm used SAML signature.
cert - A java.security.cert.X509Certificate representing the certificate used for Signature verification
privKey - A java.security.PrivateKey representing 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.Element representation of Signed SAML Assertion
Throws:
SAMLException

sign

public Element sign(DigestMethod digestMethod,
                    String signatureMethod,
                    X509Certificate cert,
                    PrivateKey privKey)
             throws SAMLException
Description copied from interface: Assertion
Sign the SAML Assertion - Enveloped Signature

Parameters:
digestMethod - A javax.xml.crypto.dsig.DigestMethod representing the digest method used for SAML signature.
signatureMethod - A javax.xml.crypto.dsig.SignatureMethod representing the signature algorithm used SAML signature.
cert - A java.security.cert.X509Certificate representing the certificate used for Signature verification
privKey - A java.security.PrivateKey representing 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.Element representation of Signed SAML Assertion
Throws:
SAMLException

toElement

public Element toElement(Node doc)
                  throws XWSSecurityException
Description copied from interface: Assertion
Convert SAML Assertion to org.w3c.dom.Element

Parameters:
doc - the context org.w3c.dom.Node for the creation of the resulting org.w3c.dom.Element.
Returns:
org.w3c.dom.Element element representation of SAML Assertion
Throws:
XWSSecurityException

isSigned

public boolean isSigned()

fromElement

public static Assertion fromElement(Element element)
                             throws SAMLException
This constructor is used to build Assertion object from a block of existing XML that has already been built into a DOM.

Parameters:
assertionElement - A org.w3c.dom.Element representing DOM tree for Assertion object
Throws:
SAMLException - if it could not process the Element properly, implying that there is an error in the sender or in the element definition.

getType

public String getType()
Description copied from interface: Token
The type of the Token

Specified by:
getType in interface Token

getStatements

public List<Object> getStatements()
Description copied from interface: Assertion
Return all statements presents in the SAML Assertion.

Returns:
An java.util.List of java.lang.Object representing all statements present inside the SAML assertion.

getTokenValue

public Object getTokenValue()
Description copied from interface: Token
The token Value

Specified by:
getTokenValue in interface Token

verifySignature

public boolean verifySignature(PublicKey pubKey)
                        throws SAMLException
Description copied from interface: Assertion
Verify the SAML signature with the Public Key

Parameters:
pubKey - A java.security.PublicKey representing the public key used for Signature verification
Returns:
An Boolean representing whether SAML signature verification is successful or not.
Throws:
SAMLException


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.