我正在開發一個基於Grails和Vaadin 7的應用程序。我設法讓他們能夠使用SpringSecurity進行身份驗證和授權,但是我必須開發自己的Service來調用Spring Security身份驗證管理器,使其與Vaadin一起工作:SpringSecurity:如何指定記住我的身份驗證?
class SecurityService {
static transactional = true
def springSecurityService
def authenticationManager
void signIn(String username, String password) {
try {
def authentication = new UsernamePasswordAuthenticationToken(username, password)
SCH.context.authentication = authenticationManager.authenticate(authentication)
} catch (BadCredentialsException e) {
throw new SecurityException("Invalid username/password")
}
}
}
問題是,現在我需要實施remember me
身份驗證,我不知道從哪裏開始。
如何使authenticationManager
知道我希望它使用remeberMeAuthentication
?我可以從登錄視圖的複選框中獲得一個布爾值,但接下來我該怎麼處理它呢?
感謝您的指導。我會盡力深入SpringSecurity和Vaadin。我現在無法檢查你的答案是否已滿,但我想它給出了應該做什麼的概要,所以我會接受它。 – svz