joscha / play-authenticate

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

Secure an action #285

Closed raunak closed 8 years ago

raunak commented 8 years ago

How do I secure an action without using Deadbolt? By secure, I mean, the user must be authenticated prior to be able to access an action.

oexza commented 8 years ago

in the simple oauth sample this controller https://github.com/joscha/play-authenticate/blob/master/samples/java/play-authenticate-simple-oauth/app/controllers/Restricted.java is being secured by this https://github.com/joscha/play-authenticate/blob/master/samples/java/play-authenticate-simple-oauth/app/controllers/Secured.java which is just implementing play! framework authentication mechanism, no extra nothing but i dont see why you wouldn't wanna use deadbolt, deadbolt is raw power!

raunak commented 8 years ago

How does that then call the various methods in the userservice implementation? Is there no annotation like in SecureSocial that can be used?

raunak commented 8 years ago

As you pointed out @oexza, securing action using Security.Authenticator works fine. The issue was, I'm trying to use the new DI mechanism instead of plugins, which prevented the onStart method from being called for the plugins.