Class DSS1CoreMessageParser
- java.lang.Object
-
- org.certificateservices.messages.saml2.BaseSAMLMessageParser
-
- org.certificateservices.messages.dss1.core.DSS1CoreMessageParser
-
- Direct Known Subclasses:
SweEID2DSSExtensionsMessageParser
public class DSS1CoreMessageParser extends BaseSAMLMessageParser
MessageParser for generating generate DSS 1.0 messages. Created by philip on 02/01/17.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDSS1CoreMessageParser.DSS1CoreSignatureLocationFinder-
Nested classes/interfaces inherited from class org.certificateservices.messages.saml2.BaseSAMLMessageParser
BaseSAMLMessageParser.AssertionSignatureLocationFinder, BaseSAMLMessageParser.BaseLSResourceResolver, BaseSAMLMessageParser.ConditionLookup, BaseSAMLMessageParser.EncryptedAttributeXMLConverter, BaseSAMLMessageParser.SAMLPSignatureLocationFinder, BaseSAMLMessageParser.SimpleConditionLookup
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringASSERTION_XSD_SCHEMA_1_1_RESOURCE_LOCATIONprotected static java.lang.StringBASE_JAXB_CONTEXTprotected static java.lang.StringDSS_XSD_SCHEMA_1_0_RESOURCE_LOCATIONprotected ObjectFactorydssOfstatic java.lang.StringNAMESPACEstatic java.lang.StringSAML_1_1_NAMESPACE-
Fields inherited from class org.certificateservices.messages.saml2.BaseSAMLMessageParser
ASSERTION_NAMESPACE, ASSERTION_XSD_SCHEMA_2_0_RESOURCE_LOCATION, assertionSignatureLocationFinder, cf, customisations, customJAXBClasspath, customSchemaLocations, DEFAULT_SAML_VERSION, dsigOf, messageSecurityProvider, of, PROTOCOL_NAMESPACE, SAMLP_XSD_SCHEMA_2_0_RESOURCE_LOCATION, samlpOf, samlpSignatureLocationFinder, schemaValidator, SETTING_CUSTOM_JAXBCLASSPATH, SETTING_CUSTOM_SCHEMALOCATIONS, systemTime, xmlEncrypter, xmlSigner
-
-
Constructor Summary
Constructors Constructor Description DSS1CoreMessageParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResultgenResult(java.lang.String resultMajor, java.lang.String resultMinor, java.lang.String resultMessage, java.lang.String resultMessageLang)Help method to generate a Result structure.SignRequestgenSignRequest(java.lang.String requestID, java.lang.String profile, java.util.List<java.lang.Object> optionalInputs, InputDocuments inputDocuments)Method to generate a SignRequestbyte[]genSignRequest(ContextMessageSecurityProvider.Context context, java.lang.String requestID, java.lang.String profile, java.util.List<java.lang.Object> optionalInputs, InputDocuments inputDocuments, boolean sign)Method to generate a marshalled SignRequest that is optionally signed.SignResponsegenSignResponse(java.lang.String requestID, java.lang.String profile, Result result, java.util.List<java.lang.Object> optionalOutputs, SignatureObject signatureObject)Method to generate a SignResponse.byte[]genSignResponse(ContextMessageSecurityProvider.Context context, java.lang.String requestID, java.lang.String profile, Result result, java.util.List<java.lang.Object> optionalOutputs, SignatureObject signatureObject, boolean sign)Method to generate a marshalled SignResponse that is optionally signed.VerifyRequestgenVerifyRequest(java.lang.String requestID, java.lang.String profile, java.util.List<java.lang.Object> optionalInputs, InputDocuments inputDocuments, SignatureObject signatureObject)Method to generate a VerifyRequestbyte[]genVerifyRequest(ContextMessageSecurityProvider.Context context, java.lang.String requestID, java.lang.String profile, java.util.List<java.lang.Object> optionalInputs, InputDocuments inputDocuments, SignatureObject signatureObject, boolean sign)Method to generate a marshalled VerifyRequest that is optionally signed.javax.xml.bind.JAXBElement<ResponseBaseType>genVerifyResponse(java.lang.String requestID, java.lang.String profile, Result result, java.util.List<java.lang.Object> optionalOutputs)Method to generate a VerifyResponse.byte[]genVerifyResponse(ContextMessageSecurityProvider.Context context, java.lang.String requestID, java.lang.String profile, Result result, java.util.List<java.lang.Object> optionalOutputs, boolean sign)Method to generate a marshalled VerifyResponse that is optionally signed.java.lang.String[]getDefaultSchemaLocations()java.lang.StringgetJAXBPackages()java.lang.StringgetNameSpace()Method that should return the main namespace of the packateXMLSigner.OrganisationLookupgetOrganisationLookup()XMLSigner.SignatureLocationFindergetSignatureLocationFinder()protected java.lang.StringlookupSchemaForElement(java.lang.String type, java.lang.String namespaceURI, java.lang.String publicId, java.lang.String systemId, java.lang.String baseURI)Method to find Schema for a specific element related to the custom schema locations.voidpopulateRequestBase(RequestBaseType requestBase, java.lang.String requestID, java.lang.String profile, java.util.List<java.lang.Object> optionalInputs, InputDocuments inputDocuments)Method to populate all fields in a base request objectprotected voidpopulateResponseBase(ResponseBaseType responseBase, java.lang.String requestID, java.lang.String profile, Result result, java.util.List<java.lang.Object> optionalOutputs)Method to populate all fields in a base resposnse object-
Methods inherited from class org.certificateservices.messages.saml2.BaseSAMLMessageParser
decryptAssertion, generateSchema, genFailureMessage, genFailureMessage, genSuccessfulSAMLPResponse, getAssertionFromResponseType, getCertificateFromAssertion, getDocumentBuilder, getJAXBContext, getMarshaller, getUnmarshaller, init, init, marshall, marshallAndSign, marshallAndSignSAMLPOrAssertion, marshallDoc, parseMessage, schemaValidate, unmarshall, unmarshallDoc, verifyAssertionConditions, verifyConditions
-
-
-
-
Field Detail
-
NAMESPACE
public static final java.lang.String NAMESPACE
- See Also:
- Constant Field Values
-
SAML_1_1_NAMESPACE
public static final java.lang.String SAML_1_1_NAMESPACE
- See Also:
- Constant Field Values
-
BASE_JAXB_CONTEXT
protected static final java.lang.String BASE_JAXB_CONTEXT
- See Also:
- Constant Field Values
-
ASSERTION_XSD_SCHEMA_1_1_RESOURCE_LOCATION
protected static final java.lang.String ASSERTION_XSD_SCHEMA_1_1_RESOURCE_LOCATION
- See Also:
- Constant Field Values
-
DSS_XSD_SCHEMA_1_0_RESOURCE_LOCATION
protected static final java.lang.String DSS_XSD_SCHEMA_1_0_RESOURCE_LOCATION
- See Also:
- Constant Field Values
-
dssOf
protected ObjectFactory dssOf
-
-
Method Detail
-
getNameSpace
public java.lang.String getNameSpace()
Description copied from class:BaseSAMLMessageParserMethod that should return the main namespace of the packate- Specified by:
getNameSpacein classBaseSAMLMessageParser
-
getJAXBPackages
public java.lang.String getJAXBPackages()
- Specified by:
getJAXBPackagesin classBaseSAMLMessageParser- Returns:
- all related JAXBPackages.
-
getDefaultSchemaLocations
public java.lang.String[] getDefaultSchemaLocations() throws org.xml.sax.SAXException- Specified by:
getDefaultSchemaLocationsin classBaseSAMLMessageParser- 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
-
getSignatureLocationFinder
public XMLSigner.SignatureLocationFinder getSignatureLocationFinder()
- Specified by:
getSignatureLocationFinderin classBaseSAMLMessageParser- Returns:
- returns the implementation locating the signature element of a specific message.
-
getOrganisationLookup
public XMLSigner.OrganisationLookup getOrganisationLookup()
- Specified by:
getOrganisationLookupin classBaseSAMLMessageParser- Returns:
- the implementation to lookup related organisation in a specific message.
-
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:BaseSAMLMessageParserMethod 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:
lookupSchemaForElementin classBaseSAMLMessageParser- 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.
-
genSignRequest
public SignRequest genSignRequest(java.lang.String requestID, java.lang.String profile, java.util.List<java.lang.Object> optionalInputs, InputDocuments inputDocuments)
Method to generate a SignRequest- Parameters:
requestID- This attribute is used to correlate requests with responses. When present in a request, the server MUST return it in the response. (Optional, use null to not set).profile- This attribute indicates a particular DSS profile. It may be used to select a profile if a server supports multiple profiles, or as a sanity-check to make sure the server implements the profile the client expects. (Optional, use null to not set).optionalInputs- Any additional inputs to the request. (Optional, use null to not set).inputDocuments- The input documents which the processing will be applied to. (Optional, use null to not set).- Returns:
- a newly created SignRequest.
-
genSignRequest
public byte[] genSignRequest(ContextMessageSecurityProvider.Context context, java.lang.String requestID, java.lang.String profile, java.util.List<java.lang.Object> optionalInputs, InputDocuments inputDocuments, boolean sign) throws MessageProcessingException, MessageContentException
Method to generate a marshalled SignRequest that is optionally signed.- Parameters:
context- message security related context. Use null if no signature should be used.requestID- This attribute is used to correlate requests with responses. When present in a request, the server MUST return it in the response. (Optional, use null to not set).profile- This attribute indicates a particular DSS profile. It may be used to select a profile if a server supports multiple profiles, or as a sanity-check to make sure the server implements the profile the client expects. (Optional, use null to not set).optionalInputs- Any additional inputs to the request. (Optional, use null to not set).inputDocuments- The input documents which the processing will be applied to. (Optional, use null to not set).sign- if message should contains signature.- Returns:
- a marshalled an optionally signed message.
- Throws:
MessageProcessingException- if internal error occurred generating the message.MessageContentException- if bad message format was detected.
-
genSignResponse
public SignResponse genSignResponse(java.lang.String requestID, java.lang.String profile, Result result, java.util.List<java.lang.Object> optionalOutputs, SignatureObject signatureObject)
Method to generate a SignResponse.- Parameters:
requestID- This attribute is used to correlate requests with responses. When present in a request, the server MUST return it in the response. (Optional, use null to not set).profile- This attribute indicates a particular DSS profile. It may be used to select a profile if a server supports multiple profiles, or as a sanity-check to make sure the server implements the profile the client expects. (Optional, use null to not set).result- A code representing the status of the request. (Required).optionalOutputs- Any additional outputs returned by the server. (Optional, use null to not set).signatureObject- The result signature or timestamp or, in the case of a signature being enveloped in an output document (see section 3.5.8), a pointer to the signature.In the case of SignaturePlacement being used this MUST contain a SignaturePtr, having the same XPath expression as in SignaturePlacement and pointing to a DocumentWithSignature using it's WhichDocument attribute. (Optional, use null to not set).- Returns:
- a newly created SignResponse.
-
genSignResponse
public byte[] genSignResponse(ContextMessageSecurityProvider.Context context, java.lang.String requestID, java.lang.String profile, Result result, java.util.List<java.lang.Object> optionalOutputs, SignatureObject signatureObject, boolean sign) throws MessageProcessingException, MessageContentException
Method to generate a marshalled SignResponse that is optionally signed.- Parameters:
context- message security related context. Use null if no signature should be used.requestID- This attribute is used to correlate requests with responses. When present in a request, the server MUST return it in the response. (Optional, use null to not set).profile- This attribute indicates a particular DSS profile. It may be used to select a profile if a server supports multiple profiles, or as a sanity-check to make sure the server implements the profile the client expects. (Optional, use null to not set).result- A code representing the status of the request. (Required).optionalOutputs- Any additional outputs returned by the server. (Optional, use null to not set).signatureObject- The result signature or timestamp or, in the case of a signature being enveloped in an output document (see section 3.5.8), a pointer to the signature.In the case of SignaturePlacement being used this MUST contain a SignaturePtr, having the same XPath expression as in SignaturePlacement and pointing to a DocumentWithSignature using it's WhichDocument attribute. (Optional, use null to not set).sign- if message should contain signature.- Returns:
- a marshalled an optionally signed message.
- Throws:
MessageProcessingException- if internal error occurred generating the message.MessageContentException- if bad message format was detected.
-
genVerifyRequest
public VerifyRequest genVerifyRequest(java.lang.String requestID, java.lang.String profile, java.util.List<java.lang.Object> optionalInputs, InputDocuments inputDocuments, SignatureObject signatureObject)
Method to generate a VerifyRequest- Parameters:
requestID- This attribute is used to correlate requests with responses. When present in a request, the server MUST return it in the response. (Optional, use null to not set).profile- This attribute indicates a particular DSS profile. It may be used to select a profile if a server supports multiple profiles, or as a sanity-check to make sure the server implements the profile the client expects. (Optional, use null to not set).optionalInputs- Any additional inputs to the request. (Optional, use null to not set).inputDocuments- The input documents which the processing will be applied to. (Optional, use null to not set).signatureObject- This element contains a signature or timestamp, or else contains a SignaturePtr that points to an XML signature in one of the input documents. If this element is omitted, there must be only a single InputDocument which the server will search to find the to-be-verified signature(s). Either a SignaturePtr or a single InputDocument and no SignatureObject MUST be used whenever the to-be-verified signature is an XML signature which uses an Enveloped Signature Transform; otherwise the server would have difficulty locating the signature and applying the Enveloped Signature Transform. (Optional, use null to not set).- Returns:
- a newly created VerifyRequest.
-
genVerifyRequest
public byte[] genVerifyRequest(ContextMessageSecurityProvider.Context context, java.lang.String requestID, java.lang.String profile, java.util.List<java.lang.Object> optionalInputs, InputDocuments inputDocuments, SignatureObject signatureObject, boolean sign) throws MessageProcessingException, MessageContentException
Method to generate a marshalled VerifyRequest that is optionally signed.- Parameters:
context- message security related context. Use null if no signature should be used.requestID- This attribute is used to correlate requests with responses. When present in a request, the server MUST return it in the response. (Optional, use null to not set).profile- This attribute indicates a particular DSS profile. It may be used to select a profile if a server supports multiple profiles, or as a sanity-check to make sure the server implements the profile the client expects. (Optional, use null to not set).optionalInputs- Any additional inputs to the request. (Optional, use null to not set).inputDocuments- The input documents which the processing will be applied to. (Optional, use null to not set).signatureObject- This element contains a signature or timestamp, or else contains a SignaturePtr that points to an XML signature in one of the input documents. If this element is omitted, there must be only a single InputDocument which the server will search to find the to-be-verified signature(s). Either a SignaturePtr or a single InputDocument and no SignatureObject MUST be used whenever the to-be-verified signature is an XML signature which uses an Enveloped Signature Transform; otherwise the server would have difficulty locating the signature and applying the Enveloped Signature Transform. (Optional, use null to not set).sign- if message should contain signature.- Returns:
- a marshalled an optionally signed message.
- Throws:
MessageProcessingException- if internal error occurred generating the message.MessageContentException- if bad message format was detected.
-
genVerifyResponse
public javax.xml.bind.JAXBElement<ResponseBaseType> genVerifyResponse(java.lang.String requestID, java.lang.String profile, Result result, java.util.List<java.lang.Object> optionalOutputs)
Method to generate a VerifyResponse.- Parameters:
requestID- This attribute is used to correlate requests with responses. When present in a request, the server MUST return it in the response. (Optional, use null to not set).profile- This attribute indicates a particular DSS profile. It may be used to select a profile if a server supports multiple profiles, or as a sanity-check to make sure the server implements the profile the client expects. (Optional, use null to not set).result- A code representing the status of the request. (Required).optionalOutputs- Any additional outputs returned by the server. (Optional, use null to not set).- Returns:
- a newly created VerifyResponse.
-
genVerifyResponse
public byte[] genVerifyResponse(ContextMessageSecurityProvider.Context context, java.lang.String requestID, java.lang.String profile, Result result, java.util.List<java.lang.Object> optionalOutputs, boolean sign) throws MessageProcessingException, MessageContentException
Method to generate a marshalled VerifyResponse that is optionally signed.- Parameters:
context- message security related context. Use null if no signature should be used.requestID- This attribute is used to correlate requests with responses. When present in a request, the server MUST return it in the response. (Optional, use null to not set).profile- This attribute indicates a particular DSS profile. It may be used to select a profile if a server supports multiple profiles, or as a sanity-check to make sure the server implements the profile the client expects. (Optional, use null to not set).result- A code representing the status of the request. (Required).optionalOutputs- Any additional outputs returned by the server. (Optional, use null to not set).sign- if message should contain signature.- Returns:
- a marshalled an optionally signed message.
- Throws:
MessageProcessingException- if internal error occurred generating the message.MessageContentException- if bad message format was detected.
-
populateRequestBase
public void populateRequestBase(RequestBaseType requestBase, java.lang.String requestID, java.lang.String profile, java.util.List<java.lang.Object> optionalInputs, InputDocuments inputDocuments)
Method to populate all fields in a base request object- Parameters:
requestBase- the object to populate.requestID- This attribute is used to correlate requests with responses. When present in a request, the server MUST return it in the response. (Optional, use null to not set).profile- This attribute indicates a particular DSS profile. It may be used to select a profile if a server supports multiple profiles, or as a sanity-check to make sure the server implements the profile the client expects. (Optional, use null to not set).optionalInputs- Any additional inputs to the request. (Optional, use null to not set).inputDocuments- The input documents which the processing will be applied to. (Optional, use null to not set).
-
genResult
public Result genResult(java.lang.String resultMajor, java.lang.String resultMinor, java.lang.String resultMessage, java.lang.String resultMessageLang)
Help method to generate a Result structure.- Parameters:
resultMajor- The most significant component of the result code. (Required)resultMinor- The least significant component of the result code. (Optional, use null to not set.)resultMessage- message which MAY be returned to an operator, logged, used for debugging, etc. (Optional, use null to not set.)resultMessageLang- a xml:lang attribute to a human-readable string to specify the string's language. (Required if resultMessage is set, otherwise null.- Returns:
- a populated result structure.
- See Also:
for applicable values for both resultMajor and resultMinor.
-
populateResponseBase
protected void populateResponseBase(ResponseBaseType responseBase, java.lang.String requestID, java.lang.String profile, Result result, java.util.List<java.lang.Object> optionalOutputs)
Method to populate all fields in a base resposnse object- Parameters:
responseBase- the object to populate.requestID- This attribute is used to correlate requests with responses. When present in a request, the server MUST return it in the response. (Optional, use null to not set).profile- This attribute indicates a particular DSS profile. It may be used to select a profile if a server supports multiple profiles, or as a sanity-check to make sure the server implements the profile the client expects. (Optional, use null to not set).result- A code representing the status of the request. (Required).optionalOutputs- Any additional outputs returned by the server. (Optional, use null to not set).
-
-