Class DefaultSignRequestProcessor

java.lang.Object
se.idsec.signservice.integration.process.impl.DefaultSignRequestProcessor
All Implemented Interfaces:
SignRequestProcessor

public class DefaultSignRequestProcessor extends Object implements SignRequestProcessor
Default implementation of the SignRequestProcessor interface.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Constructor Details

    • DefaultSignRequestProcessor

      public DefaultSignRequestProcessor()
      Constructor.
  • Method Details

    • preProcess

      public se.idsec.signservice.integration.SignRequestInput preProcess(se.idsec.signservice.integration.SignRequestInput signRequestInput, IntegrationServiceConfiguration config, String callerId) throws se.idsec.signservice.integration.core.error.InputValidationException
      Performs validation of the supplied sign request input against the supplied configuration. The returned SignRequestInput object is the supplied input updated with default values from the configuration.
      Specified by:
      preProcess in interface SignRequestProcessor
      Parameters:
      signRequestInput - the sign request input
      config - the configuration under which we are processing the request
      callerId - optional ID for the calling entity
      Returns:
      an updated sign request input object where all required fields are filled in
      Throws:
      se.idsec.signservice.integration.core.error.InputValidationException - if validation of the input fails
    • process

      public SignRequestProcessingResult process(se.idsec.signservice.integration.SignRequestInput signRequestInput, String requestID, IntegrationServiceConfiguration config) throws se.idsec.signservice.integration.core.error.SignServiceIntegrationException
      Processes that sign request input and produces a dss:SignRequest message.
      Specified by:
      process in interface SignRequestProcessor
      Parameters:
      signRequestInput - the validated input
      requestID - the unique ID for this request
      config - configuration
      Returns:
      the SignRequest
      Throws:
      se.idsec.signservice.integration.core.error.SignServiceIntegrationException - for processing errors
    • signSignRequest

      protected Document signSignRequest(SignRequestWrapper signRequest, String correlationID, se.swedenconnect.security.credential.PkiCredential signingCredential) throws InternalSignServiceIntegrationException
      Signs the supplied SignRequest message.
      Parameters:
      signRequest - the SignRequest message to sign
      correlationID - the correlation ID for this operation
      signingCredential - the signing credential to use
      Returns:
      a signed document
      Throws:
      InternalSignServiceIntegrationException - for signature errors
    • getTbsDocumentProcessors

      public List<TbsDocumentProcessor<?>> getTbsDocumentProcessors()
      Gets an unmutable list of installed processors for "to be signed" documents.
      Specified by:
      getTbsDocumentProcessors in interface SignRequestProcessor
      Returns:
      the processors for tbsDocuments
    • setTbsDocumentProcessors

      public void setTbsDocumentProcessors(List<TbsDocumentProcessor<?>> tbsDocumentProcessors)
      Sets the list of TBS document processors.
      Parameters:
      tbsDocumentProcessors - the document processors
    • setSignMessageProcessor

      public void setSignMessageProcessor(SignMessageProcessor signMessageProcessor)
      Assigns the sign message processor to use.
      Parameters:
      signMessageProcessor - the sign message processor
    • setDocumentCache

      public void setDocumentCache(DocumentCache documentCache)
      Assigns the document cache to use.
      Parameters:
      documentCache - the document cache
    • setDefaultVersion

      public void setDefaultVersion(String defaultVersion)
      Assigns the default version to use. If not set, section 3.1 of "DSS Extension for Federated Central Signing Services" states that version 1.1 is the default. So, if the defaultVersion is not set, we don't include the version unless a feature that requires a higher version is used.
      Parameters:
      defaultVersion - the version to default to
    • getNow

      protected static XMLGregorianCalendar getNow()
      Returns the current time in XML time format.
      Returns:
      the current time
    • afterPropertiesSet

      @PostConstruct public void afterPropertiesSet() throws Exception
      Ensures that all required properties have been assigned.

      Note: If executing in a Spring Framework environment this method is automatically invoked after all properties have been assigned. Otherwise it should be explicitly invoked.

      Throws:
      Exception - if not all settings are correct