Skip to content

Commit

Permalink
Ei aseteta CSRF-tokenia koska csrf-suojaus ei lähetysapissa päällä
Browse files Browse the repository at this point in the history
  • Loading branch information
jkorri committed Jan 7, 2024
1 parent 250020b commit 72d93a2
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import java.util

class ViestinvalitysClientImpl(casClient: CasClient, endpoint: String, callerId: String) extends ViestinvalitysClient {

final val CSRF_VALUE = "CSRF";

val objectMapper = {
val mapper = new ObjectMapper()
mapper.registerModule(new Jdk8Module())
Expand All @@ -35,10 +33,8 @@ class ViestinvalitysClientImpl(casClient: CasClient, endpoint: String, callerId:
.setBody(objectMapper.writeValueAsString(body))
.setRequestTimeout(10000)
.addHeader("Caller-Id", this.callerId)
.addHeader("CSRF", CSRF_VALUE)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Cookie", String.format("CSRF=%s;", CSRF_VALUE)).build()
.addHeader("Accept", "application/json").build()

override def luoLahetys(lahetys: Lahetys): LuoLahetysSuccessResponse =
val response = casClient.executeAndRetryWithCleanSessionOnStatusCodes(getJsonPostRequest(APIConstants.LAHETYKSET_PATH, lahetys), util.Set.of(401)).get()
Expand All @@ -58,10 +54,8 @@ class ViestinvalitysClientImpl(casClient: CasClient, endpoint: String, callerId:
.addBodyPart(new ByteArrayPart("liite", liite.getBytes(), liite.getSisaltoTyyppi, null, liite.getTiedostoNimi))
.setRequestTimeout(10000)
.addHeader("Caller-Id", this.callerId)
.addHeader("CSRF", CSRF_VALUE)
.addHeader("Content-Type", "multipart/form-data")
.addHeader("Accept", "application/json")
.addHeader("Cookie", String.format("CSRF=%s;", CSRF_VALUE)).build()
.addHeader("Accept", "application/json").build()
val response = casClient.executeAndRetryWithCleanSessionOnStatusCodes(request, util.Set.of(401)).get()
val successResponse = objectMapper.readValue(response.getResponseBody, classOf[LuoLiiteSuccessResponseImpl])
successResponse
Expand Down

0 comments on commit 72d93a2

Please sign in to comment.