From d03d9f5ee0d575e4e6a911f431ce0b2a35e1f342 Mon Sep 17 00:00:00 2001 From: gakuzzzz Date: Mon, 19 Nov 2012 19:10:11 +0900 Subject: [PATCH] change for stable 0.4 --- README.ja.md | 32 ++++++++++++-------------------- README.md | 32 ++++++++++++-------------------- 2 files changed, 24 insertions(+), 40 deletions(-) diff --git a/README.ja.md b/README.ja.md index ca62787..045f11d 100644 --- a/README.ja.md +++ b/README.ja.md @@ -10,7 +10,7 @@ Play2.0 module for Authentication and Authorization [![Build Status](https://sec Java版には [Deadbolt 2](https://github.com/schaloner/deadbolt-2) というモジュールがありますので こちらも参考にして下さい。 -Play2.0final、Play2.0.1 および Play2.0.3 で動作確認をしています。 +Play2.0.4 で動作確認をしています。 動機 --------------------------------------- @@ -45,17 +45,17 @@ Play2.0final、Play2.0.1 および Play2.0.3 で動作確認をしています 1. `Build.scala` もしくは `build.sbt` にライブラリ依存性定義を追加します。 1. 安定版 - "jp.t2v" % "play20.auth_2.9.1" % "0.3" + "jp.t2v" % "play20.auth_2.9.1" % "0.4" 1. 開発版 - "jp.t2v" % "play20.auth_2.9.1" % "0.4-SNAPSHOT" + "jp.t2v" % "play20.auth_2.9.1" % "0.5-SNAPSHOT" For example: `Build.scala` ```scala val appDependencies = Seq( - "jp.t2v" % "play20.auth_2.9.1" % "0.3" + "jp.t2v" % "play20.auth_2.9.1" % "0.4" ) val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings( @@ -116,30 +116,22 @@ For example: `Build.scala` /** * ログインが成功した際に遷移する先を指定します。 */ - def loginSucceeded[A](request: Request[A]): PlainResult = Redirect(routes.Message.main) -// 0.4-SNAPSHOT では以下のシグネチャになります。 -// def loginSucceeded(request: RequestHeader): PlainResult = Redirect(routes.Message.main) + def loginSucceeded(request: RequestHeader): PlainResult = Redirect(routes.Message.main) /** * ログアウトが成功した際に遷移する先を指定します。 */ - def logoutSucceeded[A](request: Request[A]): PlainResult = Redirect(routes.Application.login) -// 0.4-SNAPSHOT では以下のシグネチャになります。 -// def logoutSucceeded(request: RequestHeader): PlainResult = Redirect(routes.Application.login) + def logoutSucceeded(request: RequestHeader): PlainResult = Redirect(routes.Application.login) /** * 認証が失敗した場合に遷移する先を指定します。 */ - def authenticationFailed[A](request: Request[A]): PlainResult = Redirect(routes.Application.login) -// 0.4-SNAPSHOT では以下のシグネチャになります。 -// def authenticationFailed(request: RequestHeader): PlainResult = Redirect(routes.Application.login) + def authenticationFailed(request: RequestHeader): PlainResult = Redirect(routes.Application.login) /** * 認可(権限チェック)が失敗した場合に遷移する先を指定します。 */ - def authorizationFailed[A](request: Request[A]): PlainResult = Forbidden("no permission") -// 0.4-SNAPSHOT では以下のシグネチャになります。 -// def authorizationFailed(request: RequestHeader): PlainResult = Forbidden("no permission") + def authorizationFailed(request: RequestHeader): PlainResult = Forbidden("no permission") /** * 権限チェックのアルゴリズムを指定します。 @@ -291,10 +283,10 @@ trait AuthConfigImpl extends AuthConfig { // 他の設定省略 - def authenticationFailed[A](request: Request[A]): PlainResult = + def authenticationFailed(request: RequestHeader): PlainResult = Redirect(routes.Application.login).withSession("access_uri" -> request.uri) - def loginSucceeded[A](request: Request[A]): PlainResult = { + def loginSucceeded(request: RequestHeader): PlainResult = { val uri = request.session.get("access_uri").getOrElse(routes.Message.main.url) request.session - "access_uri" Redirect(uri) @@ -455,8 +447,8 @@ trait AuthConfigImpl extends AuthConfig { // 他の設定省略 - override def resolver[A](implicit request: Request[A]) = - new CookieRelationResolver[Id, A](request) + override def resolver(implicit request: RequestHeader) = + new CookieRelationResolver[Id](request) } ``` diff --git a/README.md b/README.md index 0e1b4bd..376e230 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This module targets the __Scala__ version of __Play2.0__. For the Java version of Play2.0, there is an authorization module called [Deadbolt 2](https://github.com/schaloner/deadbolt-2). -This module has been tested on Play2.0final, Play2.0.1 and Play2.0.3. +This module has been tested on Play2.0.4. Motivation --------------------------------------- @@ -46,17 +46,17 @@ Installation 1. Add a dependency declaration into your `Build.scala` or `build.sbt` file: 1. For the stable release: - "jp.t2v" % "play20.auth_2.9.1" % "0.3" + "jp.t2v" % "play20.auth_2.9.1" % "0.4" 1. Current snapshot version: - "jp.t2v" % "play20.auth_2.9.1" % "0.4-SNAPSHOT" + "jp.t2v" % "play20.auth_2.9.1" % "0.5-SNAPSHOT" For example your `Build.scala` might look like this: ```scala val appDependencies = Seq( - "jp.t2v" % "play20.auth_2.9.1" % "0.3" + "jp.t2v" % "play20.auth_2.9.1" % "0.4" ) val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings( @@ -118,30 +118,22 @@ Usage /** * Where to redirect the user after a successful login. */ - def loginSucceeded[A](request: Request[A]): PlainResult = Redirect(routes.Message.main) -// At 0.4-SNAPSHOT or grator, the signature becomes the following. -// def loginSucceeded(request: RequestHeader): PlainResult = Redirect(routes.Message.main) + def loginSucceeded(request: RequestHeader): PlainResult = Redirect(routes.Message.main) /** * Where to redirect the user after logging out */ - def logoutSucceeded[A](request: Request[A]): PlainResult = Redirect(routes.Application.login) -// At 0.4-SNAPSHOT or grator, the signature becomes the following. -// def logoutSucceeded(request: RequestHeader): PlainResult = Redirect(routes.Application.login) + def logoutSucceeded(request: RequestHeader): PlainResult = Redirect(routes.Application.login) /** * If the user is not logged in and tries to access a protected resource then redirct them as follows: */ - def authenticationFailed[A](request: Request[A]): PlainResult = Redirect(routes.Application.login) -// At 0.4-SNAPSHOT or grator, the signature becomes the following. -// def authenticationFailed(request: RequestHeader): PlainResult = Redirect(routes.Application.login) + def authenticationFailed(request: RequestHeader): PlainResult = Redirect(routes.Application.login) /** * If authorization failed (usually incorrect password) redirect the user as follows: */ - def authorizationFailed[A](request: Request[A]): PlainResult = Forbidden("no permission") -// At 0.4-SNAPSHOT or grator, the signature becomes the following. -// def authorizationFailed(request: RequestHeader): PlainResult = Forbidden("no permission") + def authorizationFailed(request: RequestHeader): PlainResult = Forbidden("no permission") /** * A function that determines what `Authority` a user has. @@ -292,10 +284,10 @@ trait AuthConfigImpl extends AuthConfig { // Other settings are omitted. - def authenticationFailed[A](request: Request[A]): PlainResult = + def authenticationFailed(request: RequestHeader): PlainResult = Redirect(routes.Application.login).withSession("access_uri" -> request.uri) - def loginSucceeded[A](request: Request[A]): PlainResult = { + def loginSucceeded(request: RequestHeader): PlainResult = { val uri = request.session.get("access_uri").getOrElse(routes.Message.main.url.toString) request.session - "access_uri" Redirect(uri) @@ -449,8 +441,8 @@ trait AuthConfigImpl extends AuthConfig { // Other settings omitted. - override def resolver[A](implicit request: Request[A]) = - new CookieRelationResolver[Id, A](request) + override def resolver(implicit request: RequestHeader) = + new CookieRelationResolver[Id](request) } ```