Class DefaultCSMessageParser
- java.lang.Object
-
- org.certificateservices.messages.csmessages.DefaultCSMessageParser
-
- All Implemented Interfaces:
CSMessageParser
public class DefaultCSMessageParser extends java.lang.Object implements CSMessageParser
Default implementation of CS Message Parser.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classDefaultCSMessageParser.CSMessageSignatureLocationFinder
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCSMESSAGE_NAMESPACEstatic java.lang.StringCSMESSAGE_XSD_SCHEMA_2_0_RESOURCE_LOCATIONstatic java.lang.StringCSMESSAGE_XSD_SCHEMA_2_1_RESOURCE_LOCATIONstatic java.lang.StringCSMESSAGE_XSD_SCHEMA_2_2_RESOURCE_LOCATIONstatic java.lang.StringDEFAULT_CSMESSAGE_PROTOCOLstatic java.lang.StringDEFAULT_MESSAGE_NAME_CATALOGUE_IMPLstatic java.lang.StringOLD_SETTING_MESSAGE_NAME_CATALOGUE_IMPLstatic java.lang.StringOLD_SETTING_REQUIRESIGNATUREstatic java.lang.StringOLD_SETTING_SIGNstatic java.lang.StringOLD_SETTING_SOURCEIDstatic java.lang.StringSETTING_MESSAGE_NAME_CATALOGUE_IMPLstatic java.lang.StringSETTING_REQUIRESIGNATUREstatic java.lang.StringSETTING_SIGNstatic java.lang.StringSETTING_SOURCEIDstatic java.lang.StringXMLDSIG_NAMESPACEstatic java.lang.StringXMLDSIG_XSD_SCHEMA_RESOURCE_LOCATIONstatic java.lang.StringXMLENC_NAMESPACEstatic java.lang.StringXMLENC_XSD_SCHEMA_RESOURCE_LOCATION
-
Constructor Summary
Constructors Constructor Description DefaultCSMessageParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CSMessageResponseDatagenCSFailureResponse(java.lang.String relatedEndEntity, byte[] request, RequestStatus status, java.lang.String failureMessage, java.lang.String destinationID, Credential originator)Method to generate a failure message response to a given request.CSMessagegenCSMessage(java.lang.String version, java.lang.String payLoadVersion, java.lang.String requestName, java.lang.String messageId, java.lang.String destinationID, java.lang.String organisation, Credential originator, java.lang.Object payload, java.util.List<java.lang.Object> assertions)Method that populates all fields except the signature of a CS message.byte[]generateCSRequestMessage(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String payLoadVersion, java.lang.Object payload, java.util.List<java.lang.Object> assertions)Method used to generate a CS Request message without any originator, i.e the signer of this message is the originator.byte[]generateCSRequestMessage(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String payLoadVersion, java.lang.Object payload, Credential originator, java.util.List<java.lang.Object> assertions)Method used to generate a CS Request message with any originator, used with relying a request message from another system.CSMessageResponseDatagenerateCSResponseMessage(java.lang.String relatedEndEntity, CSMessage request, java.lang.String payLoadVersion, java.lang.Object payload)Method to generate a CS Respone message from a request.CSMessageResponseDatagenerateCSResponseMessage(java.lang.String relatedEndEntity, CSMessage request, java.lang.String payLoadVersion, java.lang.Object payload, boolean isForwardableResponse)Method to generate a CS Respone message from a request.byte[]generateGetApprovalRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, byte[] request, Credential originator, java.util.List<java.lang.Object> assertions)Method generate a Get Approval Request,CSMessageResponseDatagenerateGetApprovalResponse(java.lang.String relatedEndEntity, CSMessage request, java.lang.String approvalId, ApprovalStatus approvalStatus, java.util.List<java.lang.Object> assertions)Method generate a Get Approved Response,byte[]generateIsApprovedRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String approvalId, Credential originator, java.util.List<java.lang.Object> assertions)Method generate a Is Approved Request,CSMessageResponseDatagenerateIsApprovedResponse(java.lang.String relatedEndEntity, CSMessage request, ApprovalStatus approvalStatus, java.util.List<java.lang.Object> assertions)Method generate a Is Approved Response,java.lang.StringgetCSMessageVersion()Method to return the CSMessageVersion set in generated request messages.javax.xml.bind.MarshallergetMarshaller(CSMessage message)Method that fetches the related marshaller for a given message.MessageSecurityProvidergetMessageSecurityProvider()Help method to return the related message security provider.CredentialgetOriginatorFromRequest(CSMessage request)Method to extract the originator credential from a message.java.security.cert.X509CertificategetSigningCertificate(byte[] request)Fetches the signing certificate from the request.CSMessageVersiongetVersionFromMessage(byte[] messageData)Method that tries to parse the xml version from a messagevoidinit(MessageSecurityProvider securityProvider, java.util.Properties config)Method that initializes the CSMessage parser with a security provider and properties.byte[]marshallAndSignCSMessage(CSMessage csMessage)Method that generates the signature and marshalls the message to byte array in UTF-8 format.byte[]marshallCSMessage(CSMessage csMessage)Method that marshalls the message to byte array in UTF-8 format without adding any signature.CSMessageparseMessage(byte[] messageData)Method to parse a message into a CSMessage and verify that it fulfills the registred schemas.CSMessageparseMessage(byte[] messageData, boolean performValidation)Method to parse a message into a CSMessage and verify that it fulfills the registred schemas.CSMessageparseMessage(byte[] messageData, boolean performValidation, boolean requireSignature)Method to parse a message into a CSMessage and verify that it fulfills the registred schemas.CSMessageparseMessage(org.w3c.dom.Document doc)Method to parse a message into a CSMessage and verify that it fulfills the registred schemas.CSMessageparseMessage(org.w3c.dom.Document doc, boolean performValidation)Method to parse a message into a CSMessage and verify that it fulfills the registred schemas.CSMessageparseMessage(org.w3c.dom.Document doc, boolean performValidation, boolean requireSignature)Method to parse a message into a CSMessage and verify that it fulfills the registred schemas.byte[]populateOriginatorAssertionsAndSignCSMessage(CSMessage message, java.lang.String destinationId, Credential originator, java.util.List<java.lang.Object> assertions)Method to add an originator and assertions to a CSMessage and add a signature.voidsetCSMessageVersion(java.lang.String csMessageVersion)Method to set the CSMessageVersion set in generated request messages.voidvalidatePayloadObject(CSMessageVersion version, java.lang.Object payLoadObject)Method to validate a payload object separately, used for special cases such when validating GetApprovalRequest requestData etc.
-
-
-
Field Detail
-
SETTING_SOURCEID
public static final java.lang.String SETTING_SOURCEID
- See Also:
- Constant Field Values
-
OLD_SETTING_SOURCEID
public static final java.lang.String OLD_SETTING_SOURCEID
- See Also:
- Constant Field Values
-
SETTING_SIGN
public static final java.lang.String SETTING_SIGN
- See Also:
- Constant Field Values
-
OLD_SETTING_SIGN
public static final java.lang.String OLD_SETTING_SIGN
- See Also:
- Constant Field Values
-
SETTING_REQUIRESIGNATURE
public static final java.lang.String SETTING_REQUIRESIGNATURE
- See Also:
- Constant Field Values
-
OLD_SETTING_REQUIRESIGNATURE
public static final java.lang.String OLD_SETTING_REQUIRESIGNATURE
- See Also:
- Constant Field Values
-
SETTING_MESSAGE_NAME_CATALOGUE_IMPL
public static final java.lang.String SETTING_MESSAGE_NAME_CATALOGUE_IMPL
- See Also:
- Constant Field Values
-
OLD_SETTING_MESSAGE_NAME_CATALOGUE_IMPL
public static final java.lang.String OLD_SETTING_MESSAGE_NAME_CATALOGUE_IMPL
- See Also:
- Constant Field Values
-
DEFAULT_MESSAGE_NAME_CATALOGUE_IMPL
public static final java.lang.String DEFAULT_MESSAGE_NAME_CATALOGUE_IMPL
-
CSMESSAGE_NAMESPACE
public static final java.lang.String CSMESSAGE_NAMESPACE
- See Also:
- Constant Field Values
-
CSMESSAGE_XSD_SCHEMA_2_0_RESOURCE_LOCATION
public static final java.lang.String CSMESSAGE_XSD_SCHEMA_2_0_RESOURCE_LOCATION
- See Also:
- Constant Field Values
-
CSMESSAGE_XSD_SCHEMA_2_1_RESOURCE_LOCATION
public static final java.lang.String CSMESSAGE_XSD_SCHEMA_2_1_RESOURCE_LOCATION
- See Also:
- Constant Field Values
-
CSMESSAGE_XSD_SCHEMA_2_2_RESOURCE_LOCATION
public static final java.lang.String CSMESSAGE_XSD_SCHEMA_2_2_RESOURCE_LOCATION
- See Also:
- Constant Field Values
-
XMLDSIG_XSD_SCHEMA_RESOURCE_LOCATION
public static final java.lang.String XMLDSIG_XSD_SCHEMA_RESOURCE_LOCATION
- See Also:
- Constant Field Values
-
XMLENC_XSD_SCHEMA_RESOURCE_LOCATION
public static final java.lang.String XMLENC_XSD_SCHEMA_RESOURCE_LOCATION
- See Also:
- Constant Field Values
-
XMLDSIG_NAMESPACE
public static final java.lang.String XMLDSIG_NAMESPACE
- See Also:
- Constant Field Values
-
XMLENC_NAMESPACE
public static final java.lang.String XMLENC_NAMESPACE
- See Also:
- Constant Field Values
-
DEFAULT_CSMESSAGE_PROTOCOL
public static final java.lang.String DEFAULT_CSMESSAGE_PROTOCOL
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(MessageSecurityProvider securityProvider, java.util.Properties config) throws MessageProcessingException
Description copied from interface:CSMessageParserMethod that initializes the CSMessage parser with a security provider and properties.- Specified by:
initin interfaceCSMessageParser- Parameters:
securityProvider- the CSMessage security provider to use.config- the configuration of the parser.- Throws:
MessageProcessingException- if configuration contained bad configuration of security provider.- See Also:
CSMessageParser.init(org.certificateservices.messages.MessageSecurityProvider, java.util.Properties)
-
parseMessage
public CSMessage parseMessage(byte[] messageData) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod to parse a message into a CSMessage and verify that it fulfills the registred schemas.This method always validates and authorizes the signing certificate.
- Specified by:
parseMessagein interfaceCSMessageParser- Parameters:
messageData- the data to parse into a CSMessage- Returns:
- a parsed CS Message object.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.parseMessage(byte[])
-
parseMessage
public CSMessage parseMessage(byte[] messageData, boolean performValidation) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod to parse a message into a CSMessage and verify that it fulfills the registred schemas.Signatures are required.
- Specified by:
parseMessagein interfaceCSMessageParser- Parameters:
messageData- the data to parse into a CSMessageperformValidation- true if the message security provider should perform validate that the signing certificate is valid and authorized for related organisation. Otherwise must validation be performed manually after the message is parsed.- Returns:
- a parsed CS Message object.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.parseMessage(byte[], boolean)
-
parseMessage
public CSMessage parseMessage(byte[] messageData, boolean performValidation, boolean requireSignature) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod to parse a message into a CSMessage and verify that it fulfills the registred schemas.- Specified by:
parseMessagein interfaceCSMessageParser- Parameters:
messageData- the data to parse into a CSMessageperformValidation- true if the message security provider should perform validate that the signing certificate is valid and authorized for related organisation. Otherwise must validation be performed manually after the message is parsed.requireSignature- if signature should be required.- Returns:
- a parsed CS Message object.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.parseMessage(byte[], boolean, boolean)
-
parseMessage
public CSMessage parseMessage(org.w3c.dom.Document doc, boolean performValidation) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod to parse a message into a CSMessage and verify that it fulfills the registred schemas.Signatures are required.
- Specified by:
parseMessagein interfaceCSMessageParser- Parameters:
doc- The Document data to parse into a CSMessageperformValidation- true if the message security provider should perform validate that the signing certificate is valid and authorized for related organisation. Otherwise must validation be performed manually after the message is parsed.- Returns:
- a parsed CS Message object.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.parseMessage(Document, boolean)
-
parseMessage
public CSMessage parseMessage(org.w3c.dom.Document doc, boolean performValidation, boolean requireSignature) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod to parse a message into a CSMessage and verify that it fulfills the registred schemas.Signatures are required.
- Specified by:
parseMessagein interfaceCSMessageParser- Parameters:
doc- The Document data to parse into a CSMessageperformValidation- true if the message security provider should perform validate that the signing certificate is valid and authorized for related organisation. Otherwise must validation be performed manually after the message is parsed.requireSignature- if signature should be required.- Returns:
- a parsed CS Message object.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.parseMessage(Document, boolean, boolean)
-
parseMessage
public CSMessage parseMessage(org.w3c.dom.Document doc) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod to parse a message into a CSMessage and verify that it fulfills the registred schemas.This method always validates and authorizes the signing certificate.
- Specified by:
parseMessagein interfaceCSMessageParser- Parameters:
doc- The Document data to parse into a CSMessage- Returns:
- a parsed CS Message object.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.parseMessage(Document)
-
generateCSRequestMessage
public byte[] generateCSRequestMessage(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String payLoadVersion, java.lang.Object payload, java.util.List<java.lang.Object> assertions) throws MessageContentException, MessageProcessingExceptionDescription copied from interface:CSMessageParserMethod used to generate a CS Request message without any originator, i.e the signer of this message is the originator.- Specified by:
generateCSRequestMessagein interfaceCSMessageParser- Parameters:
requestId- id of request to send.destinationId- the destination Id to use.organisation- the related organisation (short name)payLoadVersion- version of the pay load structure.payload- the pay load objectassertions- a list of authorization assertions or null if no assertions should be inserted.- Returns:
- a generated and signed (if configured) message.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.generateCSRequestMessage(String, String, String, String, Object, List)
-
generateCSRequestMessage
public byte[] generateCSRequestMessage(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String payLoadVersion, java.lang.Object payload, Credential originator, java.util.List<java.lang.Object> assertions) throws MessageContentException, MessageProcessingExceptionDescription copied from interface:CSMessageParserMethod used to generate a CS Request message with any originator, used with relying a request message from another system.- Specified by:
generateCSRequestMessagein interfaceCSMessageParser- Parameters:
requestId- id of request to send.destinationId- the destination Id to use.organisation- the related organisation (short name)payLoadVersion- version of the pay load structure.payload- the payload objectoriginator- the credential of the original requester.assertions- a list of authorization assertions or null if no assertions should be inserted.- Returns:
- a generated and signed (if configured) message.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.generateCSRequestMessage(String, String, String, String, Object, Credential, List)
-
generateCSResponseMessage
public CSMessageResponseData generateCSResponseMessage(java.lang.String relatedEndEntity, CSMessage request, java.lang.String payLoadVersion, java.lang.Object payload) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod to generate a CS Respone message from a request. CS Response message will be marked as non forwardable, which means not for use in data syncronization applications.- Specified by:
generateCSResponseMessagein interfaceCSMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the related requestpayLoadVersion- version of the pay load structure.payload- the payload object- Returns:
- a generated and signed (if configured) message.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.generateCSResponseMessage(String, CSMessage, String, Object)
-
generateCSResponseMessage
public CSMessageResponseData generateCSResponseMessage(java.lang.String relatedEndEntity, CSMessage request, java.lang.String payLoadVersion, java.lang.Object payload, boolean isForwardableResponse) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod to generate a CS Respone message from a request.- Specified by:
generateCSResponseMessagein interfaceCSMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the related requestpayLoadVersion- version of the pay load structure.payload- the payload objectisForwardableResponse- if message will be marked as non forwardable, i.e. for use in data syncronization applications.- Returns:
- a generated and signed (if configured) message.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.generateCSResponseMessage(String, CSMessage, String, Object)
-
generateGetApprovalRequest
public byte[] generateGetApprovalRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, byte[] request, Credential originator, java.util.List<java.lang.Object> assertions) throws MessageContentException, MessageProcessingExceptionDescription copied from interface:CSMessageParserMethod generate a Get Approval Request,- Specified by:
generateGetApprovalRequestin interfaceCSMessageParser- Parameters:
requestId- id of request to send.destinationId- the destination Id to use.organisation- the related organisation (short name)request- the request message to get approval for.originator- the credential of the original requester, null if this is the origin of the request.assertions- a list of related authorization assertions, or null if no authorization assertions is available.- Returns:
- a generated and signed (if configured) message.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.generateGetApprovalRequest(String, String, String, byte[], Credential, List)
-
generateIsApprovedRequest
public byte[] generateIsApprovedRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String approvalId, Credential originator, java.util.List<java.lang.Object> assertions) throws MessageContentException, MessageProcessingExceptionDescription copied from interface:CSMessageParserMethod generate a Is Approved Request,- Specified by:
generateIsApprovedRequestin interfaceCSMessageParser- Parameters:
requestId- id of request to send.destinationId- the destination Id to use.organisation- the related organisation (short name)approvalId- the approval id to check.originator- the credential of the original requester, null if this is the origin of the request.assertions- a list of related authorization assertions, or null if no authorization assertions is available.- Returns:
- a generated and signed (if configured) message.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.generateIsApprovedRequest(String, String, String, String, Credential, List)
-
generateIsApprovedResponse
public CSMessageResponseData generateIsApprovedResponse(java.lang.String relatedEndEntity, CSMessage request, ApprovalStatus approvalStatus, java.util.List<java.lang.Object> assertions) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod generate a Is Approved Response,- Specified by:
generateIsApprovedResponsein interfaceCSMessageParser- Parameters:
relatedEndEntity- the user name of related user in system.request- the request data.approvalStatus- the status of the related approval Id.assertions- a list of related authorization assertions, or null if no authorization assertions is available.- Returns:
- a generated and signed (if configured) message.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.generateIsApprovedResponse(String, CSMessage, ApprovalStatus, List)
-
generateGetApprovalResponse
public CSMessageResponseData generateGetApprovalResponse(java.lang.String relatedEndEntity, CSMessage request, java.lang.String approvalId, ApprovalStatus approvalStatus, java.util.List<java.lang.Object> assertions) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod generate a Get Approved Response,- Specified by:
generateGetApprovalResponsein interfaceCSMessageParser- Parameters:
relatedEndEntity- the user name of related user in system.request- the request data.approvalId- the approval id that was generated for the requestapprovalStatus- the approval statusassertions- a list of related authorization assertions, or null if no authorization assertions is available.- Returns:
- a generated and signed (if configured) message.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.generateGetApprovalResponse(String, CSMessage, String, ApprovalStatus, List)
-
genCSFailureResponse
public CSMessageResponseData genCSFailureResponse(java.lang.String relatedEndEntity, byte[] request, RequestStatus status, java.lang.String failureMessage, java.lang.String destinationID, Credential originator) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod to generate a failure message response to a given request.- Specified by:
genCSFailureResponsein interfaceCSMessageParser- Parameters:
relatedEndEntity- the user name of related user in system.request- the request data.status- the request status of the responsefailureMessage- a readable failure message.destinationID- the destination id of the message. If null will destination id be extracted from request data.originator- originator of the request, null if no originator could be found.- Returns:
- Throws:
MessageProcessingException- if internal error occurred parsing the certificate.MessageContentException- See Also:
CSMessageParser.genCSFailureResponse(String, byte[], RequestStatus, String, String, Credential)
-
getSigningCertificate
public java.security.cert.X509Certificate getSigningCertificate(byte[] request) throws MessageContentException, MessageProcessingExceptionDescription copied from interface:CSMessageParserFetches the signing certificate from the request.- Specified by:
getSigningCertificatein interfaceCSMessageParser- Parameters:
request- the request to parse the certificate from.- Returns:
- the signer certificate of null if no certificate is required by the parser.
- Throws:
MessageProcessingException- if internal error occurred parsing the certificate.MessageContentException- See Also:
CSMessageParser.getSigningCertificate(byte[])
-
genCSMessage
public CSMessage genCSMessage(java.lang.String version, java.lang.String payLoadVersion, java.lang.String requestName, java.lang.String messageId, java.lang.String destinationID, java.lang.String organisation, Credential originator, java.lang.Object payload, java.util.List<java.lang.Object> assertions) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod that populates all fields except the signature of a CS message.- Specified by:
genCSMessagein interfaceCSMessageParser- Parameters:
version- , version of the CS MessagepayLoadVersion- , version of the pay load structure.requestName- the name in the a related request if this is a response message, or null if no related request existsmessageId- the id of the message, if null is a random id generated.destinationID- the destination Id to use.organisation- the related organisationoriginator- the originator of the message if applicable.payload- the payload object to set in the objectassertions- a list of authorization assertions used along with this message.- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.genCSMessage(String, String, String, String, String, String, Credential, Object, List)
-
populateOriginatorAssertionsAndSignCSMessage
public byte[] populateOriginatorAssertionsAndSignCSMessage(CSMessage message, java.lang.String destinationId, Credential originator, java.util.List<java.lang.Object> assertions) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod to add an originator and assertions to a CSMessage and add a signature. If signature exists it is removed.- Specified by:
populateOriginatorAssertionsAndSignCSMessagein interfaceCSMessageParser- Parameters:
message- the message to populate.destinationId- the updated destination, null for unchanged.originator- the originator to add, null for no originatorassertions- the assertions to add, null for no assertions.- Returns:
- a populated and signed CSMessage.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.- See Also:
CSMessageParser.populateOriginatorAssertionsAndSignCSMessage(CSMessage, String, Credential, List)
-
marshallAndSignCSMessage
public byte[] marshallAndSignCSMessage(CSMessage csMessage) throws MessageProcessingException, MessageContentException
Method that generates the signature and marshalls the message to byte array in UTF-8 format.- Specified by:
marshallAndSignCSMessagein interfaceCSMessageParser- Parameters:
csMessage- the PKIMessage to sign and marshall, never null.- Returns:
- a marshalled and signed message.
- Throws:
MessageProcessingException- if problems occurred when processing the message.MessageContentException- if unsupported version is detected in message.
-
marshallCSMessage
public byte[] marshallCSMessage(CSMessage csMessage) throws MessageProcessingException, MessageContentException
Method that marshalls the message to byte array in UTF-8 format without adding any signature.- Specified by:
marshallCSMessagein interfaceCSMessageParser- Parameters:
csMessage- the CSMessage to marshall, never null.- Returns:
- a marshalled message.
- Throws:
MessageProcessingException- if problems occurred when processing the message.MessageContentException
-
getVersionFromMessage
public CSMessageVersion getVersionFromMessage(byte[] messageData) throws MessageContentException, MessageProcessingException
Method that tries to parse the xml version from a message- Specified by:
getVersionFromMessagein interfaceCSMessageParser- Parameters:
messageData- the messageData to extract version from.- Returns:
- the version in the version and payLoadVersion attributes of the message.
- Throws:
MessageContentException- didn't contains a valid version attribute.MessageProcessingException- if internal problems occurred.
-
getMessageSecurityProvider
public MessageSecurityProvider getMessageSecurityProvider()
Description copied from interface:CSMessageParserHelp method to return the related message security provider.- Specified by:
getMessageSecurityProviderin interfaceCSMessageParser- Returns:
- the related message security provider, never null.
-
getMarshaller
public javax.xml.bind.Marshaller getMarshaller(CSMessage message) throws MessageContentException, MessageProcessingException
Description copied from interface:CSMessageParserMethod that fetches the related marshaller for a given message.- Specified by:
getMarshallerin interfaceCSMessageParser- Parameters:
message- the message to fetch related marshaller for.- Returns:
- the marshaller
- Throws:
MessageContentException- if message content was faulty or no related marshaller could be found.MessageProcessingException- if internal error occurred processing the message.
-
validatePayloadObject
public void validatePayloadObject(CSMessageVersion version, java.lang.Object payLoadObject) throws MessageContentException
Method to validate a payload object separately, used for special cases such when validating GetApprovalRequest requestData etc.- Specified by:
validatePayloadObjectin interfaceCSMessageParser- Parameters:
version- the versions of a CS message.payLoadObject- the pay load object to validate schema for.- Throws:
MessageProcessingExceptionMessageContentException- if the message contained invalid XML.
-
getOriginatorFromRequest
public Credential getOriginatorFromRequest(CSMessage request)
Description copied from interface:CSMessageParserMethod to extract the originator credential from a message.- Specified by:
getOriginatorFromRequestin interfaceCSMessageParser- Parameters:
request- the request message to extract the originator from.- Returns:
- the originator credential from the message or null if no originator was found.
-
getCSMessageVersion
public java.lang.String getCSMessageVersion()
Method to return the CSMessageVersion set in generated request messages. Response messages always use the same version as in the request. This is automatically set to the latest version.- Returns:
- the CS Message Version used.
-
setCSMessageVersion
public void setCSMessageVersion(java.lang.String csMessageVersion)
Method to set the CSMessageVersion set in generated request messages. Should only be used under special cases. Response messages always use the same version as in the request. CSMessageVersion is automatically set to the latest version.
-
-