javaplayframeworkplayframework-2.4deadbolt-2

Play 2.4 and Deadbolt installation


So I'm still getting to grips with Play 2.4 I wanted to use Deadbolt for authentication but it doesn't seem to be resolving any of the deadbolt classes.

In my build.sbt,

libraryDependencies ++= Seq(
javaJdbc,
  cache,
  javaWs,
  "be.objectify" %% "deadbolt-java" % "2.4.4"
)

In my play.plugins,

10000:be.objectify.deadbolt.java.DeadboltPlugin

In my application.conf,

deadbolt.java.handler=security.LoginHandler

The LoginHandler class,

package security;

import be.objectify.deadbolt.java.DeadboltHandler; //does not resolve

public class LoginHandler implements DeadboltHandler {
}

It's not resolving any of the deadbolt packages.


Solution

  • It seems the documentation from http://deadbolt.ws/#/java-docs is a bit outdated.

    Starting with version 2.4 Deadbolt is using dependency injection (DI) instead of the (deprecated) plugin mechanism of Play. So you don't need the play.plugins file anymore. Check out the release notes for Deadbolt 2.4.

    I recommend to follow the Quick start guide instead: https://github.com/schaloner/deadbolt-2-java/blob/master/QuickStart.md It should get you started.

    Also have a look at the Deadbolt 2 Java examples: https://github.com/schaloner/deadbolt-2-java-examples - they should be up to date.