Class SubjectConfirmation


  • @SupportedAll
    public class SubjectConfirmation
    extends Object
    The SubjectConfirmation element specifies a subject by specifying data that authenticates the subject.
    • Constructor Detail

      • SubjectConfirmation

        public SubjectConfirmation​(Element subjectConfirmationElement)
                            throws SAMLException
        Constructs a subject confirmation element from an existing XML block.
        Parameters:
        subjectConfirmationElement - a DOM Element representing the SubjectConfirmation object.
        Throws:
        SAMLException - If there was an error while constructing this object.
      • SubjectConfirmation

        public SubjectConfirmation​(String confirmationMethod)
                            throws SAMLException
        Constructor with a single confirmation method.
        Parameters:
        confirmationMethod - A URI (String) that identifies a protocol used to authenticate a Subject. Please refer to draft-sstc-core-25 Section 7 for a list of URIs identifying common authentication protocols.
        Throws:
        SAMLException - if the input data is null.
      • SubjectConfirmation

        public SubjectConfirmation​(Set confirmationMethods)
                            throws SAMLException
        Constructor for multiple confirmation methods
        Parameters:
        confirmationMethods - a Set of confirmationMethods
        Throws:
        SAMLException - if the confirmationMethods is empty.
      • SubjectConfirmation

        public SubjectConfirmation​(Set confirmationMethods,
                                   Element subjectConfirmationData,
                                   Element keyInfo)
                            throws SAMLException
        Constructs an SubjectConfirmation instance.
        Parameters:
        confirmationMethods - A set of confirmationMethods each of which is a URI (String) that identifies a protocol used to authenticate a Subject. Please refer to draft-sstc-core-25 Section 7 for a list of URIs identifying common authentication protocols.
        subjectConfirmationData - Additional authentication information to be used by a specific authentication protocol. Can be passed as null if there is no subjectConfirmationData for the SubjectConfirmation object.
        keyInfo - An XML signature element that specifies a cryptographic key held by the Subject.
        Throws:
        SAMLException - if the input data is invalid or confirmationMethods is empty.
    • Method Detail

      • addConfirmationMethod

        public boolean addConfirmationMethod​(String confirmationMethod)
        Adds a confirmationMethod to this SubjectConfirmation element.
        Parameters:
        confirmationMethod - a String which is a URI (String) that identifies a protocol used to authenticate a Subject.
        Returns:
        true indicating success of the operation.
      • getConfirmationMethod

        public Set getConfirmationMethod()
        Gets Confirmation Method(s)
        Returns:
        A java.util.Set of confirmation Methods. Each method contained within is a String representing the confirmation method.
      • getSubjectConfirmationData

        public Element getSubjectConfirmationData()
        Get Subject Confirmation Data
        Returns:
        A String representation of the subject confirmation data with the Subject Confirmation element
      • setSubjectConfirmationData

        public boolean setSubjectConfirmationData​(Element subjectConfirmationData)
        Sets the SubjectConfirmationData
        Parameters:
        subjectConfirmationData - A String representation of the subject confirmation data within this SubjectConfirmation element
        Returns:
        true indicating success of the operation.
      • setSubjectConfirmationData

        public boolean setSubjectConfirmationData​(String scDataString)
        Sets the SubjectConfirmationData.
        Parameters:
        scDataString - A String representation of the subject confirmation data within this SubjectConfirmation element.
        Returns:
        true if the operation succeed.
      • getKeyInfo

        public Element getKeyInfo()
        Returns the key info.
        Returns:
        The key info.
      • setKeyInfo

        public boolean setKeyInfo​(Element keyInfo)
        Sets the key info.
        Parameters:
        keyInfo - dsig.KeyInfo.
        Returns:
        true if operations succeeds.
      • equals

        public boolean equals​(SubjectConfirmation subjectConfirmation)
        Checks for equality between this object and the SubjectConfirmation passed down as parameter. Checks to see that each have confirmations method present in the other one (does not care about sequence) Also does an exact match on SubjectConfirmationData. Note: no check is done for KeyInfo.
        Parameters:
        subjectConfirmation - SubjectConfirmation to be checked.
        Returns:
        true if the two are EXACTLY equal.
      • toString

        public String toString()
        Returns a String representation of the element
        Overrides:
        toString in class Object
        Returns:
        A string containing the valid XML for this element By default name space name is prepended to the element name example <saml:SubjectConfirmation>.
      • toString

        public String toString​(boolean includeNS,
                               boolean declareNS)
        Returns a String representation of the <SubjectConfirmation> element.
        Parameters:
        includeNS - Determines whether or not the namespace qualifier is prepended to the Element when converted
        declareNS - Determines whether or not the namespace is declared within the Element.
        Returns:
        A string containing the valid XML for this element.