2012-01-01 23 views
-3

私はSpring Security Plugin(from here)をインストールしました。私は非常に密接にブログ投稿に従ったhere。私は、ブログの記事の中で述べてと全く同じでしたが、私は、プラグインを介してログインしようとしたとき、私はこのようなエラーを取得していにもかかわらず:私はSpring Security Plugin経由でログインできません

:ここ

Sorry, we were not able to find a user with that username and password. 

は私BootStrap.groovyファイルです

def springSecurityService 
    def init = { 
      def userRole = SecRole.findByAuthority('ROLE_USER') ?: new SecRole(authority: 'ROLE_USER').save(failOnError: true) 
      def adminRole = SecRole.findByAuthority('ROLE_USER') ?: new SecRole(authority: 'ROLE_USER').save(failOnError: true)  
      def adminUser = SecUser.findByUsername('antoaravinth') ?: new SecUser(
        username: 'antoaravinth', 
        password: springSecurityService.encodePassword('secret'), 
        enabled: true).save() 

       if (!adminUser.authorities.contains(adminRole)) { 
        SecUserSecRole.create adminUser, adminRole 
       } 
      println "adminUser is $adminUser" 
      println "adminRole is $adminRole" 
} 

私が試したときにgrails run-appadminUseradminRoleの両方の値が私のコンソールに表示されています。しかし、それでも私はログインすることができませんでした。なぜですか?

ありがとうございます。

+0

あなたは慎重にブログ記事を読んでいないと私はあなたが自分を探してではなく、SO上のあらゆる問題の解決を求める必要がありますね。 –

+0

@downvoters:なぜdownvote? –

+0

ああ大変申し訳ありません!私は読んでいる間にその部分をスキップしました:(このような愚かな質問のために申し訳ありません!! –

答えて

2

ポストはあなたのログインが失敗する理由を説明し、このアップデートがあります。春のセキュリティコア・プラグインのバージョン1.2のとおり

アップデートを、 生成したUserクラスは自動的に インスタンスが保存されているパスワードをエンコードします。したがって、あなたは、もはや明示的 SpringSecurityService.encodePasswordを使用する必要はありません()

+0

ああ、非常に申し訳ありません..!私は読んでいる間にその部分をスキップしました:(そのような愚かな質問を申し訳ありません!! –

関連する問題