Skip to content

Commit

Permalink
Fikser litt renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
thburnett committed Oct 23, 2023
1 parent b06e9cf commit 1ca934f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .nais/cpa-repo-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ spec:
inbound:
rules:
- application: ebms-provider
- application: payload-processor
- application: ebms-payload
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ->
Expand Down Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1ca934f

Please sign in to comment.