簡體   English   中英

使用Dynamodb的Grails春季安全性

[英]Grails spring security using dynamodb

我無法使用Spring Security和dynamodb登錄到Grails應用程序中。

Grails是2.1,安裝的插件是spring-security核心和dynamodb。

用戶和角色是由s2-quickstart創建的,它的唯一修改是通過向用戶,角色和userrole類添加String id和static mapWith =“ dynamodb”(因為在dynamodb上的id是UUID生成的,所以需要String id)

Bootstrap是按照spring安全性教程編寫的。

應用程序正常啟動,並創建動態表和行。

我不斷

身份驗證失敗:密碼與存儲的值不匹配

通過在LoginController上登錄(我沒有從教程中設置示例控制器)。 有任何想法嗎?

如果您配置了多個數據源,那么我猜您這樣做,因為您使用過mapWith beforeUpdate塊將被調用多次。 (對於每個數據源一次)我將以下內容添加到我的用戶域對象中,它可以正常工作。

transient hasBeforeInsert = false
transient hasBeforeUpdate = false

...

  def beforeInsert()
  {
    if(!hasBeforeInsert)
    {
      hasBeforeInsert = true
      encodePassword()
    }
  }

  def beforeUpdate()
  {
    if(!hasBeforeUpdate)
    {
      hasBeforeUpdate = true

      if(isDirty('password'))
      {
        encodePassword()
      }
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM