2013-05-01 29 views
0

我已經設置了一個使用Spring Security插件的Grails應用程序。我使用了插件設置的默認設置。Grails中的Spring Security插件在哪裏檢查用戶的密碼?

我不能爲我的生活弄清楚在密碼鎖定的地方Spring Security實際上會檢查用戶的密碼,當他們點擊按鈕繼續登錄屏幕。

附帶插件完整的代碼here,但(我認爲是)相關的代碼如下:

/** 
* Show the login page. 
*/ 
def auth = { 
    def config = SpringSecurityUtils.securityConfig 

    if (springSecurityService.isLoggedIn()) { 
     redirect uri: config.successHandler.defaultTargetUrl 
     return 
    } 

    String view = 'auth' 
    String postUrl = "${request.contextPath}${config.apf.filterProcessesUrl}" 
    render view: view, model: [postUrl: postUrl, 
    rememberMeParameter: config.rememberMe.parameter] 
} 

我GOOGLE和讀取小時Grails和Spring Security的文件,並我無法破解代碼。任何幫助讚賞。

回答

0

它沒有,這是由Spring安全處理。登錄控制器不會進行身份驗證,它只是顯示登錄頁面,處理重定向等。身份驗證由攔截/j_spring_security_check URI的過濾器處理(您可以通過查看/ login/auth的來源看到這是URI表單發佈到)。

的過濾器(org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter)委託給passwordEncoder豆,這是一個org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder默認,但可以是grails.plugins.springsecurity.BCryptPasswordEncoder或自定義實現。

+0

謝謝伯特......這非常有幫助! – user1549195 2013-05-01 01:56:49

相關問題