joscha / play-authenticate

An authentication plugin for Play Framework 2.x (Java)
http://joscha.github.com/play-authenticate/
Other
807 stars 369 forks source link

Fixes a design issue that prevents extension from Scala applications #324

Closed bravegag closed 7 years ago

bravegag commented 7 years ago

The com.feth.play.module.pa.providers.password.UsernamePasswordAuthProvider abstract base implementation is used in the usage sample and requires clients to implement play.data.Form<S> getSignupForm() and play.data.Form<L> getLoginForm(). The problem is that Scala implementations will not be able to reuse the implementation because it requires Java Forms and the Form types are incompatible between Java (play.data.Form) and Scala (play.api.data.Form).

By applying this change, the partial implementation UsernamePasswordAuthProvider allows subclassing from Scala applications too at the very little cost of not having the Form bindFromRequest boilerplate code. It also allows mixed Java-Scala applications to define Forms in either way.

The client needs to provide implementation for the getSignup and getLogin directly and as implementation can use whatever Form type it prefers.

joscha commented 7 years ago

Cool, could you also adapt the usage sample, please, if needed?

bravegag commented 7 years ago

Sure! Indeed I missed that detail.

bravegag commented 7 years ago

ok done!

bravegag commented 7 years ago

Adapted test-app too but can't see why it is failing in Travis ...

joscha commented 7 years ago

it was actually the heroku update that failed...