Skip to content

Commit

Permalink
release 0.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gakuzzzz committed Mar 15, 2015
1 parent 946af61 commit a228f0f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 30 deletions.
40 changes: 25 additions & 15 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ Play2.1以前をお使いの方へ

`Build.scala` もしくは `build.sbt` にライブラリ依存性定義を追加します。

"jp.t2v" %% "play2-auth" % "0.13.0",
"jp.t2v" %% "play2-auth-test" % "0.13.0" % "test"
"jp.t2v" %% "play2-auth" % "0.13.1",
"jp.t2v" %% "play2-auth-test" % "0.13.1" % "test"

For example: `Build.scala`

```scala
val appDependencies = Seq(
"jp.t2v" %% "play2-auth" % "0.13.0",
"jp.t2v" %% "play2-auth-test" % "0.13.0" % "test"
"jp.t2v" %% "play2-auth" % "0.13.1",
"jp.t2v" %% "play2-auth-test" % "0.13.1" % "test"
)
```

Expand Down Expand Up @@ -135,8 +135,16 @@ For example: `Build.scala`
/**
* 認可(権限チェック)が失敗した場合に遷移する先を指定します。
*/
def authorizationFailed(request: RequestHeader)(implicit ctx: ExecutionContext): Future[Result] =
override def authorizationFailed(request: RequestHeader, user: User, authority: Option[Authority])(implicit context: ExecutionContext): Future[Result] = {
Future.successful(Forbidden("no permission"))
}

/**
* 互換性の為に残されているメソッドです。
* 将来のバージョンでは取り除かれる予定です。
* authorizationFailed(RequestHeader, User, Option[Authority]) を override してください。
*/
def authorizationFailed(request: RequestHeader)(implicit ctx: ExecutionContext): Future[Result] = throw new AsserionError

/**
* 権限チェックのアルゴリズムを指定します。
Expand All @@ -151,17 +159,19 @@ For example: `Build.scala`
}

/**
* SessionID Cookieにsecureオプションを指定するか否かの設定です。
* デフォルトでは利便性のために false になっていますが、
* 実際のアプリケーションでは true にすることを強く推奨します。
*/
override lazy val cookieSecureOption: Boolean = play.api.Play.isProd(play.api.Play.current)

/**
* SessionID Cookieの有効期限を、ブラウザが閉じられるまでにするか否かの設定です。
* デフォルトは false です。
* (Optional)
* SessionID Tokenの保存場所の設定です。
* デフォルトでは Cookie を使用します。
*/
override lazy val isTransientCookie: Boolean = false
override lazy val tokenAccessor = new CookieTokenAccessor(
/*
* cookie の secureオプションを使うかどうかの設定です。
* デフォルトでは利便性のために false になっていますが、
* 実際のアプリケーションでは true にすることを強く推奨します。
*/
cookieSecureOption = play.api.Play.isProd(play.api.Play.current),
cookieMaxAge = Some(sessionTimeoutInSeconds)
)

}
```
Expand Down
40 changes: 26 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ Add dependency declarations into your `Build.scala` or `build.sbt` file:

* __for Play2.3.x__

"jp.t2v" %% "play2-auth" % "0.13.0",
"jp.t2v" %% "play2-auth-test" % "0.13.0" % "test"
"jp.t2v" %% "play2-auth" % "0.13.1",
"jp.t2v" %% "play2-auth-test" % "0.13.1" % "test"

For example your `Build.scala` might look like this:

```scala
val appDependencies = Seq(
"jp.t2v" %% "play2-auth" % "0.13.0",
"jp.t2v" %% "play2-auth-test" % "0.13.0" % "test"
"jp.t2v" %% "play2-auth" % "0.13.1",
"jp.t2v" %% "play2-auth-test" % "0.13.1" % "test"
)
```

Expand All @@ -80,6 +80,8 @@ Usage

```scala
// Example
import jp.t2v.lab.play2.auth._

trait AuthConfigImpl extends AuthConfig {

/**
Expand Down Expand Up @@ -142,8 +144,16 @@ Usage
/**
* If authorization failed (usually incorrect password) redirect the user as follows:
*/
def authorizationFailed(request: RequestHeader)(implicit ctx: ExecutionContext): Future[Result] =
override def authorizationFailed(request: RequestHeader, user: User, authority: Option[Authority])(implicit context: ExecutionContext): Future[Result] = {
Future.successful(Forbidden("no permission"))
}

/**
* This method is kept for compatibility.
* It will be removed in a future version
* Override `authorizationFailed(RequestHeader, User, Option[Authority])` instead of this
*/
def authorizationFailed(request: RequestHeader)(implicit ctx: ExecutionContext): Future[Result] = throw new AsserionError

/**
* A function that determines what `Authority` a user has.
Expand All @@ -158,16 +168,18 @@ Usage
}

/**
* Whether use the secure option or not use it in the cookie.
* However default is false, I strongly recommend using true in a production.
*/
override lazy val cookieSecureOption: Boolean = play.api.Play.isProd(play.api.Play.current)

/**
* Whether a login session is closed when the brower is terminated.
* default is false.
* (Optional)
* You can custom SessionID Token handler.
* Default implemntation use Cookie.
*/
override lazy val isTransientCookie: Boolean = false
override lazy val tokenAccessor = new CookieTokenAccessor(
/*
* Whether use the secure option or not use it in the cookie.
* However default is false, I strongly recommend using true in a production.
*/
cookieSecureOption = play.api.Play.isProd(play.api.Play.current),
cookieMaxAge = Some(sessionTimeoutInSeconds)
)

}
```
Expand Down
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object ApplicationBuild extends Build {
val playVersion = play.core.PlayVersion.current

lazy val baseSettings = Seq(
version := "0.13.1-SNAPSHOT",
version := "0.13.1",
scalaVersion := "2.10.4",
crossScalaVersions := Seq("2.10.4", "2.11.1"),
organization := "jp.t2v",
Expand Down

0 comments on commit a228f0f

Please sign in to comment.