Force.com Play! Module
The Force.com Play! module allows you to easily build Play applications for Force.com users. The module provides Force.com authentication (using OAuth2) and a connector for the REST API. The module is currently in an early development stage.
Usage
Add the module as a dependency in conf/dependencies.yml
require:
- play
- force -> 0.2
Now you can write a secured controller like this:
package controllers;import play.modules.force.Force;
import play.mvc.*;
@With(controllers.force.Secure.class)
public class Application extends Controller {
public static void index() {
System.out.println(“Hello: ”+Force.forceApi(session).getIdentity().getFirstName());
}
}
The user will be redirected to log in at Force.com and once authenticated, the Play! application can access the Force.com API on behalf of the user.
The module gives access to all the functionality of the Force.com REST API Java library. That library itself is currently under development but it has support for basic CRUD and query operations. See the README on github for details on what you can do.
Reserved Routes
The module will automatically add a new route on /_auth
. Your application must not route to this path. It is reserved for the OAuth authentication flow.