joscha / play-authenticate

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

Pure Scala version of the sample play-authenticate-usage? #319

Open bravegag opened 8 years ago

bravegag commented 8 years ago

Is anyone else really wanting to have a Scala version of the play-authenticate-usage? is there some fork/work in progress? I am trying to migrate the play-authenticate-usage example to Scala, have bumped into several issues and need a hand or two :)

My stack is: Scala, Play-slick and Postgres (using Slick code gen). I'm more db-driven in my projects and the performance payoffs of using Slick over JPA seem to be substantial.

bravegag commented 8 years ago

I prepared a baby-steps migration to Scala of the play-authenticate-usage sample here: https://github.com/bravegag/play-authenticate-usage-scala. My approach is to migrate the usage sample bringing up bit by bit and keep the project overall compiling and running. As of now it compiles and runs up to the evolutions step, then a runtime exception is thrown coming from Deadbolt2.

The project uses the latest version of all dependencies. The play-authenticate unreleased dependency is built locally.

I prepared a postgres 1.sql that is installed in the database using evolutions. Later, the ./test/Generator.scala may be executed to get the generated Tables.scala under ./app/generated. There is a basic ./app/dao/UserDao.scala implementation. I'm planning to do a generic Dao for Slick using that UserDao as base.

Another thing, Deadbolt2 needs some of the Model classes implementing some traits e.g. User to implement Subject. This I plan to do by customizing the Slick code generator.

Help is most welcome!

bravegag commented 7 years ago

Status: a handful of compiler errors away from migration.

Done => All controllers, forms, and view have been migrated to Scala, peer-reviews anyone?

Pending => so far left providers package in Java but will migrate ... issue: Scala Forms and Java Form type mismatch needed for the Login and Signup forms needed by the PA framework. Need some design improvements on the Dao/Services side

bravegag commented 7 years ago

Status: first time it all runs, now get exceptions while accessing some pages ... help most welcome :)

bravegag commented 7 years ago

Migration completed, now testing ... can signup, login and verify email address already!

bravegag commented 7 years ago

Added support for Google reCAPTCHA via the (really nice) plugin https://github.com/chrisnappin/play-recaptcha. This plugin integrates super nicely with the standard Play Form infrastructure. Now the Scala usage implementation uses Google reCAPTCHA in the Signup Form

recaptcha

bravegag commented 7 years ago

btw the migration took me a month but is now complete. I had to do a small workaround in-lining the AbstractUsernamePasswordAuthProvider.java implementation (see PR #324). But once the PR #324 is merged it can be removed.

I have completed 100% test coverage of the Slick base DAO layer.

bravegag commented 7 years ago

I migrated the https://github.com/bravegag/play-authenticate-usage-scala project to PA version 0.8.3 including the changes following from PR #324