2015-02-11 71 views
2

我開發Grails應用程序,我需要與Session變量搗鼓來實現自定義Spring Security認證和需要設置以下各項Grails的春季安全的替代已過時SPRING_SECURITY_LAST_USERNAME_KEY

request.session[SPRING_SECURITY_LAST_USERNAME_KEY] = 
      TextEscapeUtils.escapeEntities(username) 

現在,這個密鑰來自org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY 現已棄用。你能爲我提供一個替代方案嗎?

回答

3

是的,我面臨同樣的問題。而且它有一個非常簡單的alternative-

import grails.plugin.springsecurity.SpringSecurityUtils; 

現在使用SpringSecurityUtils.SPRING_SECURITY_LAST_USERNAME_KEY這將工作,不會被棄用。

+1

它的工作原理。謝謝。 – Aryan 2015-02-11 12:30:25