Basic OAuth2 provider trait.
OAuth2Provider supports issue access token and authorize.
OAuth2Provider supports issue access token and authorize.
import scalaoauth2.provider._ object BookController extends Controller with OAuthProvider { def list = Action.async { implicit request => authorize(new MyDataHandler()) { authInfo => val user = authInfo.user // User is defined on your system // access resource for the user } } }
POST /oauth2/access_token controllers.OAuth2Controller.accessToken
object OAuth2Controller extends Controller with OAuth2Provider { def accessToken = Action.async { implicit request => issueAccessToken(new MyDataHandler()) } }
OAuth2AsyncProvider supports issue access token and authorize in asynchronous.
OAuth2AsyncProvider supports issue access token and authorize in asynchronous.
(Since version 0.12.0) Use OAuth2Provider
import scalaoauth2.provider._ object BookController extends Controller with OAuth2AsyncProvider { def list = Action.async { implicit request => authorize(new MyDataHandler()) { authInfo => val user = authInfo.user // User is defined on your system // access resource for the user } } }
POST /oauth2/access_token controllers.OAuth2Controller.accessToken
object OAuth2Controller extends Controller with OAuth2AsyncProvider { def accessToken = Action.async { implicit request => issueAccessToken(new MyDataHandler()) } }
Support synchronous Result for Playframework
Support synchronous Result for Playframework
callback
maximum wait time
Await and return the result.
(Since version 0.13.0) Use Await in your own
import scalaoauth2.provider._ object BookController extends Controller with OAuthProvider { def list = Action { implicit request => await(authorize(new MyDataHandler()) { authInfo => val user = authInfo.user // User is defined on your system // access resource for the user Future.successful(Ok) }) } }
POST /oauth2/access_token controllers.OAuth2Controller.accessToken
import scalaoauth2.provider._ object OAuth2Controller extends Controller with OAuth2Provider { def accessToken = Action { implicit request => await(issueAccessToken(new MyDataHandler())) } }