Skip to content

Commit a228f0f

Browse files
committed
release 0.13.1
1 parent 946af61 commit a228f0f

File tree

3 files changed

+52
-30
lines changed

3 files changed

+52
-30
lines changed

README.ja.md

+25-15
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ Play2.1以前をお使いの方へ
5252

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

55-
"jp.t2v" %% "play2-auth" % "0.13.0",
56-
"jp.t2v" %% "play2-auth-test" % "0.13.0" % "test"
55+
"jp.t2v" %% "play2-auth" % "0.13.1",
56+
"jp.t2v" %% "play2-auth-test" % "0.13.1" % "test"
5757

5858
For example: `Build.scala`
5959

6060
```scala
6161
val appDependencies = Seq(
62-
"jp.t2v" %% "play2-auth" % "0.13.0",
63-
"jp.t2v" %% "play2-auth-test" % "0.13.0" % "test"
62+
"jp.t2v" %% "play2-auth" % "0.13.1",
63+
"jp.t2v" %% "play2-auth-test" % "0.13.1" % "test"
6464
)
6565
```
6666

@@ -135,8 +135,16 @@ For example: `Build.scala`
135135
/**
136136
* 認可(権限チェック)が失敗した場合に遷移する先を指定します。
137137
*/
138-
def authorizationFailed(request: RequestHeader)(implicit ctx: ExecutionContext): Future[Result] =
138+
override def authorizationFailed(request: RequestHeader, user: User, authority: Option[Authority])(implicit context: ExecutionContext): Future[Result] = {
139139
Future.successful(Forbidden("no permission"))
140+
}
141+
142+
/**
143+
* 互換性の為に残されているメソッドです。
144+
* 将来のバージョンでは取り除かれる予定です。
145+
* authorizationFailed(RequestHeader, User, Option[Authority]) を override してください。
146+
*/
147+
def authorizationFailed(request: RequestHeader)(implicit ctx: ExecutionContext): Future[Result] = throw new AsserionError
140148

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

153161
/**
154-
* SessionID Cookieにsecureオプションを指定するか否かの設定です。
155-
* デフォルトでは利便性のために false になっていますが、
156-
* 実際のアプリケーションでは true にすることを強く推奨します。
157-
*/
158-
override lazy val cookieSecureOption: Boolean = play.api.Play.isProd(play.api.Play.current)
159-
160-
/**
161-
* SessionID Cookieの有効期限を、ブラウザが閉じられるまでにするか否かの設定です。
162-
* デフォルトは false です。
162+
* (Optional)
163+
* SessionID Tokenの保存場所の設定です。
164+
* デフォルトでは Cookie を使用します。
163165
*/
164-
override lazy val isTransientCookie: Boolean = false
166+
override lazy val tokenAccessor = new CookieTokenAccessor(
167+
/*
168+
* cookie の secureオプションを使うかどうかの設定です。
169+
* デフォルトでは利便性のために false になっていますが、
170+
* 実際のアプリケーションでは true にすることを強く推奨します。
171+
*/
172+
cookieSecureOption = play.api.Play.isProd(play.api.Play.current),
173+
cookieMaxAge = Some(sessionTimeoutInSeconds)
174+
)
165175

166176
}
167177
```

README.md

+26-14
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ Add dependency declarations into your `Build.scala` or `build.sbt` file:
5959

6060
* __for Play2.3.x__
6161

62-
"jp.t2v" %% "play2-auth" % "0.13.0",
63-
"jp.t2v" %% "play2-auth-test" % "0.13.0" % "test"
62+
"jp.t2v" %% "play2-auth" % "0.13.1",
63+
"jp.t2v" %% "play2-auth-test" % "0.13.1" % "test"
6464

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

6767
```scala
6868
val appDependencies = Seq(
69-
"jp.t2v" %% "play2-auth" % "0.13.0",
70-
"jp.t2v" %% "play2-auth-test" % "0.13.0" % "test"
69+
"jp.t2v" %% "play2-auth" % "0.13.1",
70+
"jp.t2v" %% "play2-auth-test" % "0.13.1" % "test"
7171
)
7272
```
7373

@@ -80,6 +80,8 @@ Usage
8080

8181
```scala
8282
// Example
83+
import jp.t2v.lab.play2.auth._
84+
8385
trait AuthConfigImpl extends AuthConfig {
8486

8587
/**
@@ -142,8 +144,16 @@ Usage
142144
/**
143145
* If authorization failed (usually incorrect password) redirect the user as follows:
144146
*/
145-
def authorizationFailed(request: RequestHeader)(implicit ctx: ExecutionContext): Future[Result] =
147+
override def authorizationFailed(request: RequestHeader, user: User, authority: Option[Authority])(implicit context: ExecutionContext): Future[Result] = {
146148
Future.successful(Forbidden("no permission"))
149+
}
150+
151+
/**
152+
* This method is kept for compatibility.
153+
* It will be removed in a future version
154+
* Override `authorizationFailed(RequestHeader, User, Option[Authority])` instead of this
155+
*/
156+
def authorizationFailed(request: RequestHeader)(implicit ctx: ExecutionContext): Future[Result] = throw new AsserionError
147157

148158
/**
149159
* A function that determines what `Authority` a user has.
@@ -158,16 +168,18 @@ Usage
158168
}
159169

160170
/**
161-
* Whether use the secure option or not use it in the cookie.
162-
* However default is false, I strongly recommend using true in a production.
163-
*/
164-
override lazy val cookieSecureOption: Boolean = play.api.Play.isProd(play.api.Play.current)
165-
166-
/**
167-
* Whether a login session is closed when the brower is terminated.
168-
* default is false.
171+
* (Optional)
172+
* You can custom SessionID Token handler.
173+
* Default implemntation use Cookie.
169174
*/
170-
override lazy val isTransientCookie: Boolean = false
175+
override lazy val tokenAccessor = new CookieTokenAccessor(
176+
/*
177+
* Whether use the secure option or not use it in the cookie.
178+
* However default is false, I strongly recommend using true in a production.
179+
*/
180+
cookieSecureOption = play.api.Play.isProd(play.api.Play.current),
181+
cookieMaxAge = Some(sessionTimeoutInSeconds)
182+
)
171183

172184
}
173185
```

project/Build.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object ApplicationBuild extends Build {
99
val playVersion = play.core.PlayVersion.current
1010

1111
lazy val baseSettings = Seq(
12-
version := "0.13.1-SNAPSHOT",
12+
version := "0.13.1",
1313
scalaVersion := "2.10.4",
1414
crossScalaVersions := Seq("2.10.4", "2.11.1"),
1515
organization := "jp.t2v",

0 commit comments

Comments
 (0)