@@ -59,15 +59,15 @@ Add dependency declarations into your `Build.scala` or `build.sbt` file:
59
59
60
60
* __ for Play2.3.x__
61
61
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"
64
64
65
65
For example your ` Build.scala ` might look like this:
66
66
67
67
``` scala
68
68
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"
71
71
)
72
72
```
73
73
80
80
81
81
``` scala
82
82
// Example
83
+ import jp .t2v .lab .play2 .auth ._
84
+
83
85
trait AuthConfigImpl extends AuthConfig {
84
86
85
87
/**
@@ -142,8 +144,16 @@ Usage
142
144
/**
143
145
* If authorization failed (usually incorrect password) redirect the user as follows:
144
146
*/
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 ] = {
146
148
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
147
157
148
158
/**
149
159
* A function that determines what `Authority` a user has.
@@ -158,16 +168,18 @@ Usage
158
168
}
159
169
160
170
/**
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.
169
174
*/
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
+ )
171
183
172
184
}
173
185
```
0 commit comments