2013-05-01 25 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

相关问题