Skip to content

Commit 001a914

Browse files
committed
Merge branch 'dbalduini-bugfix' into play-2.2.x
2 parents 7071af3 + ae9c31d commit 001a914

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,29 @@ and an access token type called [Bearer](http://tools.ietf.org/html/rfc6750).
2020

2121
If you'd like to use this with Playframework, add "play2-oauth2-provider" to library dependencies of your project.
2222

23+
### For Playframework 2.3
24+
25+
```scala
26+
libraryDependencies ++= Seq(
27+
"com.nulab-inc" %% "play2-oauth2-provider" % "0.8.0"
28+
)
29+
```
30+
31+
### For Playframework 2.2
32+
2333
```scala
2434
libraryDependencies ++= Seq(
2535
"com.nulab-inc" %% "play2-oauth2-provider" % "0.7.2"
2636
)
2737
```
2838

29-
Otherwise, add "scala-oauth2-core" instead. In this case, you need to implement your own OAuth provider working with web framework you use.
39+
### Other frameworks
40+
41+
Add "scala-oauth2-core" instead. In this case, you need to implement your own OAuth provider working with web framework you use.
3042

3143
```scala
3244
libraryDependencies ++= Seq(
33-
"com.nulab-inc" %% "scala-oauth2-core" % "0.7.2"
45+
"com.nulab-inc" %% "scala-oauth2-core" % "0.8.0"
3446
)
3547
```
3648

@@ -79,7 +91,7 @@ You should follow three steps below to work with Playframework.
7991
* Access to an authorized resource
8092

8193
First, define your own controller with mixining ```OAuth2Provider``` trait provided by this library to issue access token.
82-
Asynchronous result is used in your controller then you can use ```OAuth2AsyncProvider```, which supports returning ```Future[SimpleResult]```.
94+
Asynchronous result is used in your controller then you can use ```OAuth2AsyncProvider```, which supports returning ```Future[Result]```.
8395

8496
```scala
8597
import scalaoauth2.provider._

play2-oauth2-provider/src/main/scala/scalaoauth2/provider/OAuth2Provider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ trait OAuth2AsyncProvider extends OAuth2BaseProvider {
181181
* @return Request is successful then return JSON to client in OAuth 2.0 format.
182182
* Request is failed then return BadRequest or Unauthorized status to client with cause into the JSON.
183183
*/
184-
def issueAccessToken[A, U](dataHandler: DataHandler[U])(implicit request: play.api.mvc.Request[A]): Future[Result] = {
184+
def issueAccessToken[A, U](dataHandler: DataHandler[U])(implicit request: play.api.mvc.Request[A]): Future[SimpleResult] = {
185185
TokenEndpoint.handleRequest(request, dataHandler) match {
186186
case Left(e) if e.statusCode == 400 => Future.successful(BadRequest(responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e)))
187187
case Left(e) if e.statusCode == 401 => Future.successful(Unauthorized(responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e)))
@@ -199,7 +199,7 @@ trait OAuth2AsyncProvider extends OAuth2BaseProvider {
199199
* @return Authentication is successful then the response use your API result.
200200
* Authentication is failed then return BadRequest or Unauthorized status to client with cause into the JSON.
201201
*/
202-
def authorize[A, U](dataHandler: DataHandler[U])(callback: AuthInfo[U] => Future[Result])(implicit request: play.api.mvc.Request[A]): Future[Result] = {
202+
def authorize[A, U](dataHandler: DataHandler[U])(callback: AuthInfo[U] => Future[SimpleResult])(implicit request: play.api.mvc.Request[A]): Future[SimpleResult] = {
203203
ProtectedResource.handleRequest(request, dataHandler) match {
204204
case Left(e) if e.statusCode == 400 => Future.successful(BadRequest.withHeaders(responseOAuthErrorHeader(e)))
205205
case Left(e) if e.statusCode == 401 => Future.successful(Unauthorized.withHeaders(responseOAuthErrorHeader(e)))

project/Build.scala

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ import Keys._
44
object ScalaOAuth2Build extends Build {
55

66
lazy val _organization = "com.nulab-inc"
7-
lazy val _version = "0.7.2"
8-
def _playVersion(version: String) = version match {
9-
case "2.11.1" => "2.3.0"
10-
case _ => "2.2.3"
11-
}
7+
lazy val _version = "0.8.0"
8+
lazy val _playVersion = "2.3.2"
129

13-
val _scalaVersion = "2.10.3"
14-
val _crossScalaVersions = Seq("2.10.3", "2.11.1")
10+
val _scalaVersion = "2.10.4"
11+
val _crossScalaVersions = Seq("2.10.4", "2.11.1")
1512

1613
val commonDependenciesInTestScope = Seq(
1714
"org.scalatest" %% "scalatest" % "2.2.0" % "test"
@@ -59,7 +56,7 @@ object ScalaOAuth2Build extends Build {
5956
description := "Support scala-oauth2-core library on Playframework Scala",
6057
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/maven-releases/",
6158
libraryDependencies ++= Seq(
62-
"com.typesafe.play" %% "play" % _playVersion(scalaVersion.value) % "provided"
59+
"com.typesafe.play" %% "play" % _playVersion % "provided"
6360
) ++ commonDependenciesInTestScope
6461
)
6562
) dependsOn(scalaOAuth2Core)

0 commit comments

Comments
 (0)