PlayFrameworkで認証周りを実装するときSecureSocialというライブラリが便利です。(もともとPlay1.xに対応する認証関連ライブラリとしてPlayの公式サイトにも掲載されてますがPlay2.xにも対応済みで便利に使えます。) 私はNode.jsでexpressを使うときはpassportというライブラリを使うのですが、それと似たような使用感です。 以下、SecureSocialのドキュメントにある通りやったもの。 build.sbt build.sbtのresolverとlibraryDependenciesに以下のように追加。 resolvers += Resolver.url("sbt-plugin-releases", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/"))(Resolver
Play framework 2.x を触り始めていて、まず最初にユーザ登録とログインを 扱いたいと思った。 Rails であれば devise で、というところだが、Play ではどうなっているのだろう? Sample としてついてくる zentask や、 「play scala ユーザ登録」でググって上の方に出てくる ペ ー ジ を見ると、いずれもパスワードを生で保存している。 パスワードは生で保存していると何かの拍子に痛い目に合うので、真似したくない。 きっと Rails の devise みたいに再利用できるコンポーネントがあるだろうから、 それを使いたい。 Google+ のコミュニティで訪ねてみたところSecureSocial と play2-auth を教えてもらった。 SecureSocial を試してみる。 Play は 2.2.1, Scala でやる。 プロジェクト
これは Play Framework 2.x Scala Advent Calendar 2013 の25日目です。
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く