diff --git a/.nais/cpa-repo-dev.yaml b/.nais/cpa-repo-dev.yaml index 87277c74..4fb84a46 100644 --- a/.nais/cpa-repo-dev.yaml +++ b/.nais/cpa-repo-dev.yaml @@ -29,4 +29,4 @@ spec: inbound: rules: - application: ebms-provider - - application: payload-processor + - application: ebms-payload diff --git a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/HttpClientUtil.kt b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/HttpClientUtil.kt index a98a6530..034b2d22 100644 --- a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/HttpClientUtil.kt +++ b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/HttpClientUtil.kt @@ -22,14 +22,10 @@ import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.MessageHeader private val httpClientUtil = HttpClientUtil() -private const val payloadProcessorEndpoint = "http://payload-processor/payload" +private const val payloadProcessorEndpoint = "http://ebms-payload/payload" private const val cpaRepoEndpoint = "http://cpa-repo" private const val validatorEndpoint = "$cpaRepoEndpoint/validate" -fun postPayloadRequest(payloadRequest: PayloadRequest): PayloadResponse = runBlocking { - httpClientUtil.postPayloadRequest(payloadRequest) -} - fun getPublicSigningDetails(messageHeader: MessageHeader): SignatureDetails = runBlocking { getPublicSigningDetails(messageHeader.cpaId, messageHeader.from.partyId[0].type, messageHeader.from.partyId[0].value, messageHeader.service.value, messageHeader.action, messageHeader.from.role) } diff --git a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbMSPayloadMessage.kt b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbMSPayloadMessage.kt index a4226e33..426a4744 100644 --- a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbMSPayloadMessage.kt +++ b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbMSPayloadMessage.kt @@ -2,9 +2,7 @@ package no.nav.emottak.ebms.model import no.nav.emottak.EBMS_SERVICE_URI import no.nav.emottak.Event -import no.nav.emottak.ebms.processing.CPAValidationProcessor import no.nav.emottak.ebms.processing.DekrypteringProcessor -import no.nav.emottak.ebms.processing.SertifikatsjekkProcessor import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.AckRequested import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.Acknowledgment import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.ErrorList @@ -46,11 +44,11 @@ class EbMSPayloadMessage( private fun createErrorMessageHeader(): MessageHeader { return this.messageHeader.createResponseHeader( - newFromRole = "ERROR_RESPONDER", newToRole = "ERROR_RECEIVER", newAction = "EBXML_ERROR", newService = EBMS_SERVICE_URI) + newFromRole = "ERROR_RESPONDER", newToRole = "ERROR_RECEIVER", newAction = "”MessageError”", newService = EBMS_SERVICE_URI) } private fun createAcknowledgmentMessageHeader(): MessageHeader { return this.messageHeader.createResponseHeader( - newFromRole = "ACK_RESPONDER", newToRole = "ACK_RECEIVER", newAction = "EBXML_ACK", newService = EBMS_SERVICE_URI) + newFromRole = "ACK_RESPONDER", newToRole = "ACK_RECEIVER", newAction = "Acknowledgment", newService = EBMS_SERVICE_URI) } private fun createAcknowledgementJaxB(): Acknowledgment { diff --git a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/ProcessingService.kt b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/ProcessingService.kt index 9482a42b..c1d59e33 100644 --- a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/ProcessingService.kt +++ b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/ProcessingService.kt @@ -8,7 +8,6 @@ import no.nav.emottak.ebms.model.EbMSError import no.nav.emottak.ebms.model.EbMSMessageError import no.nav.emottak.ebms.model.EbMSPayloadMessage import no.nav.emottak.ebms.model.EbmsAcknowledgment -import no.nav.emottak.ebms.postPayloadRequest import no.nav.emottak.melding.model.Header import no.nav.emottak.melding.model.Party import no.nav.emottak.melding.model.PayloadRequest @@ -20,7 +19,7 @@ class ProcessingService() { var httpClient = HttpClientUtil() - private fun paylodMessage(payloadMessage: EbMSPayloadMessage) { + private fun payloadMessage(payloadMessage: EbMSPayloadMessage) { val payloads = payloadMessage.attachments val header = payloadMessage.messageHeader.payloadRequestHeader() payloads.forEach { payload -> @@ -60,12 +59,12 @@ fun MessageHeader.payloadRequestHeader(): Header { conversationId = this.conversationId, to = Party( partyType = this.to.partyId.firstOrNull()?.type ?: throw BadRequestException("Melding mangler to partyId"), - partyId = this.to.partyId.firstOrNull()?.type ?: throw BadRequestException("Melding mangler to partyId"), + partyId = this.to.partyId.firstOrNull()?.value ?: throw BadRequestException("Melding mangler to partyId"), role = this.to.role ?: throw BadRequestException("Melding mangler role for en eller flere parter") ), from = Party( partyType = this.from.partyId.firstOrNull()?.type ?: throw BadRequestException("Melding mangler from partyId"), - partyId = this.from.partyId.firstOrNull()?.type ?: throw BadRequestException("Melding mangler from partyId"), + partyId = this.from.partyId.firstOrNull()?.value ?: throw BadRequestException("Melding mangler from partyId"), role = this.from.role ?: throw BadRequestException("Melding mangler role for en eller flere parter") ), service = this.service.value ?: throw BadRequestException("Service mangler fra header"), diff --git a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/Processor.kt b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/Processor.kt index 1b0b3dbe..eb5cfe62 100644 --- a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/Processor.kt +++ b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/Processor.kt @@ -34,7 +34,7 @@ abstract class Processor(open val ebMSMessage: EbMSBaseMessage) { fun persisterHendelse(event: Event): Boolean { // Vi vil se på det ebMSMessage.addHendelse(event) when (event.eventStatus) { - Event.Status.STARTED -> log.info(this.ebMSMessage.messageHeader.marker(), "$event") + Event.Status.STARTED -> log.debug(this.ebMSMessage.messageHeader.marker(), "{}", event) Event.Status.OK -> log.info(this.ebMSMessage.messageHeader.marker(), "$event") Event.Status.FAILED -> log.error(this.ebMSMessage.messageHeader.marker(), "$event") } diff --git a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/SignaturGenerator.kt b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/SignaturGenerator.kt index ff12e32b..212762c3 100644 --- a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/SignaturGenerator.kt +++ b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/SignaturGenerator.kt @@ -14,7 +14,7 @@ fun EbMSDocument.signer(signatureDetails: SignatureDetails): EbMSDocument { try { ebMSSigning.sign(this, signatureDetails) return this - } catch (e: XMLSecurityException) { + } catch (e: Exception) { log.error(this.messageHeader().marker(), "Signering av ebms envelope feilet", e) throw SignatureException("Signering av ebms envelope feilet", e) } diff --git a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/validation/DokumentValidator.kt b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/validation/DokumentValidator.kt index 81af5e51..2e1d6e9e 100644 --- a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/validation/DokumentValidator.kt +++ b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/validation/DokumentValidator.kt @@ -18,6 +18,7 @@ class DokumentValidator { val messageHeader = dokument.messageHeader() val signaturedetails: SignatureDetails = getPublicSigningDetails(messageHeader) + //TODO valider sertifikat val header = Header(messageHeader.messageData.messageId, messageHeader.conversationId, messageHeader.cpaId,