0

I'm new to Tapestry5, but because of an internship I need to work with it.

Currently I am trying to build a mixin to integrate a CSRF token (explanation here) to any form. Is it even possible to achieve this in a mixin? If yes, could I access functions that the mixin offers from the page?

I am really not sure about how mixins really work and I'm having big difficulties on finding information about how to create one. Can somebody explain how to create a mixin and if what I'm trying to do is even possible?

Thanks a lot!

Qiu
  • 5,651
  • 10
  • 49
  • 56
RedSonja
  • 350
  • 1
  • 13
  • Some links: http://tapestry.apache.org/component-mixins.html http://stackoverflow.com/questions/17564743/how-exactly-does-tapestry-mixin-work – sody Jul 24 '13 at 10:30
  • @sody thanks, for the links, but I'm more looking for some explanation on how to implement this – RedSonja Jul 24 '13 at 12:38

1 Answers1

1

You might find that the HMAC message authentication introduced in tapestry 5.3.6 is good enough. Configuration here Jira here

If not, you will most likely write a Form mixin which adds a hidden input to a form and then checks for a RequestParameter in the form's onValidate event (a mixin can see it's component's events). If you want to implicitly add a mixin to every form, you can do this via a ComponentClassTransformWorker2 tutorial here

A bit of googling reveals this, this and this.

lance-java
  • 25,497
  • 4
  • 59
  • 101
  • Thank you! I will try that. On your last three links, I've already seen them, but I would really like to manage this on my on (you know, just for the learning effect) – RedSonja Jul 25 '13 at 12:15