"should require in id" in new Context { new WithApplication(application) { println("Require an id") val eventController = EventSpec.getEventController(application, env) val mnemonic = Mnemonic("first")
val path = controllers.organizer.routes.Event.saveDetails(mnemonic).toString val request = FakeRequest(POST, path) .withSession("csrfToken" -> "438be706aaad4ad6c21529c947ae710e2ef86087-1459500808342-853383e7fe7bd398100b7e2b") .withFormUrlEncodedBody( "id" -> "", "name" -> "Update first", "date" -> "11/12-2016 14:00", "description" -> "A long description", "website" -> "www.google.com", "contact-email" -> "con...@event.com" ) .withAuthenticator[CookieEnvironment](identityWithEvents.loginInfo) val result = eventController.saveDetails(mnemonic)(request)
status(result) must beEqualTo(BAD_REQUEST) } }[error] java.lang.RuntimeException: No CSRF token present! (CSRF.scala:29)[error] views.html.helper.CSRF$$anonfun$2.apply(CSRF.scala:29)[error] views.html.helper.CSRF$$anonfun$2.apply(CSRF.scala:29)[error] views.html.helper.CSRF$.formField(CSRF.scala:29)[error] views.html.organizer.event.detailsForm_Scope0$detailsForm_Scope1$detailsForm.apply(detailsForm.template.scala:31)println("tags --> "+request.tags)
tags --> Map(CSRF_TOKEN_RE_SIGNED -> 5699e0be647d05730d8fcf235b6ab25eb79f26bb-1459503234836-853383e7fe7bd398100b7e2b, ROUTE_COMMENTS -> , ROUTE_PATTERN -> /organizer/$mnemonic<[^/]+>/details, CSRF_TOKEN_NAME -> csrfToken, ROUTE_CONTROLLER -> controllers.organizer.Event, ROUTE_ACTION_METHOD -> saveDetails, CSRF_TOKEN -> e76844826c1b017bcb8274e81ed35d0899e6b847-1457968057499-853383e7fe7bd398100b7e2b, ROUTE_VERB -> POST)
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/fb923ef6-be95-4f51-a948-bae2517fce26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
.withSession("csrfToken" -> "438be706aaad4ad6c21529c947ae710e2ef86087-1459500808342-853383e7fe7bd398100b7e2b")
.withFormUrlEncodedBody(
"csrfToken" -> "438be706aaad4ad6c21529c947ae710e2ef86087-1459500808342-853383e7fe7bd398100b7e2b",
"id" -> "",
...
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/8de35d00-1986-40a4-ab81-1a6a96ebaaf9%40googlegroups.com.
@Singleton
class Filters @Inject() (csrfFilter: CSRFFilter, securityHeadersFilter: SecurityHeadersFilter) extends HttpFilters {
override def filters: Seq[EssentialFilter] = Seq(csrfFilter, securityHeadersFilter)
}
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/68c87e36-2dce-41c4-8b35-416f3991a6e8%40googlegroups.com.