Skip to content

Commit

Permalink
signeringen ut av domene EbmsDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
alpet committed Oct 18, 2024
1 parent 432dbf2 commit ab522bb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@ import no.nav.emottak.ebms.ebxml.acknowledgment
import no.nav.emottak.ebms.ebxml.addressing
import no.nav.emottak.ebms.ebxml.errorList
import no.nav.emottak.ebms.ebxml.messageHeader
import no.nav.emottak.ebms.xml.ebMSSigning
import no.nav.emottak.ebms.xml.xmlMarshaller
import no.nav.emottak.message.model.ErrorCode
import no.nav.emottak.message.model.Feil
import no.nav.emottak.message.model.Payload
import no.nav.emottak.message.model.SignatureDetails
import no.nav.emottak.util.marker
import no.nav.emottak.util.signatur.SignatureException
import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.MessageHeader
import org.slf4j.LoggerFactory
import org.w3c.dom.Document
import org.w3c.dom.Node
import org.xmlsoap.schemas.soap.envelope.Envelope
import java.lang.RuntimeException

val log = LoggerFactory.getLogger("no.nav.emottak.ebms.model")

Expand Down Expand Up @@ -116,13 +111,3 @@ data class EbMSDocument(val requestId: String, val dokument: Document, val attac
enum class DokumentType {
PAYLOAD, ACKNOWLEDGMENT, FAIL, STATUS, PING
}

fun EbMSDocument.signer(signatureDetails: SignatureDetails): EbMSDocument {
try {
ebMSSigning.sign(this, signatureDetails)
return this
} catch (e: Exception) {
log.error(this.messageHeader().marker(), "Signering av ebms envelope feilet", e)
throw SignatureException("Signering av ebms envelope feilet", e)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package no.nav.emottak.ebms.model

import no.nav.emottak.ebms.xml.ebMSSigning
import no.nav.emottak.message.model.SignatureDetails
import no.nav.emottak.util.marker
import no.nav.emottak.util.signatur.SignatureException

fun EbMSDocument.signer(signatureDetails: SignatureDetails): EbMSDocument {
try {
ebMSSigning.sign(this, signatureDetails)
return this
} catch (e: Exception) {
log.error(this.messageHeader().marker(), "Signering av ebms envelope feilet", e)
throw SignatureException("Signering av ebms envelope feilet", e)
}
}

0 comments on commit ab522bb

Please sign in to comment.