Class SAMLAssertionMessageParser


  • public class SAMLAssertionMessageParser
    extends BaseSAMLMessageParser
    MessageParser for generating generate SAML 2.0 Assertions. This should be used when generating SAML Assertions that is not connected to CSMessages. For CSMessage related assertions use AssertionPayloadParser. Created by philip on 02/01/17.
    • Constructor Detail

      • SAMLAssertionMessageParser

        public SAMLAssertionMessageParser()
    • Method Detail

      • getDefaultSchemaLocations

        public java.lang.String[] getDefaultSchemaLocations()
                                                     throws org.xml.sax.SAXException
        Specified by:
        getDefaultSchemaLocations in class BaseSAMLMessageParser
        Returns:
        an array of schema locations used by the parser. The string value should point to resources available using getResourceAsStream()
        Throws:
        org.xml.sax.SAXException
      • lookupSchemaForElement

        protected java.lang.String lookupSchemaForElement​(java.lang.String type,
                                                          java.lang.String namespaceURI,
                                                          java.lang.String publicId,
                                                          java.lang.String systemId,
                                                          java.lang.String baseURI)
        Description copied from class: BaseSAMLMessageParser
        Method to find Schema for a specific element related to the custom schema locations. The implementation only need to find it's related XSD, the basic datatypes and XML itself are not needed.
        Specified by:
        lookupSchemaForElement in class BaseSAMLMessageParser
        Parameters:
        type - The type of the resource being resolved. For XML [XML 1.0] resources (i.e. entities), applications must use the value "http://www.w3.org/TR/REC-xml". For XML Schema [XML Schema Part 1], applications must use the value "http://www.w3.org/2001/XMLSchema". Other types of resources are outside the scope of this specification and therefore should recommend an absolute URI in order to use this method.
        namespaceURI - The namespace of the resource being resolved, e.g. the target namespace of the XML Schema [XML Schema Part 1] when resolving XML Schema resources.
        publicId - The public identifier of the external entity being referenced, or null if no public identifier was supplied or if the resource is not an entity.
        systemId - The system identifier, a URI reference [IETF RFC 2396], of the external resource being referenced, or null if no system identifier was supplied.
        baseURI - The absolute base URI of the resource being parsed, or null if there is no base URI.
        Returns:
        the resource as stream path to related schema XSD, or null if no matching found.
      • generateSimpleAssertion

        public javax.xml.bind.JAXBElement<AssertionType> generateSimpleAssertion​(java.lang.String issuer,
                                                                                 java.util.Date notBefore,
                                                                                 java.util.Date notOnOrAfter,
                                                                                 java.lang.String subjectId,
                                                                                 java.util.List<java.lang.Object> attributes)
                                                                          throws MessageProcessingException
        Method for generating a simple assertion data structure.
        Parameters:
        issuer - the name if the issuer, set as NameIDType
        notBefore - the not before date
        notOnOrAfter - the expiration date
        subjectId - the name of the subject the assertion is related to.
        attributes - a list of attributes or encrypted attributes to add to the assertion.
        Returns:
        a simply assertion.
        Throws:
        MessageProcessingException - if internal problems occurred generating the assertion.