grails 和 spring security 核心插件 - 来自客户端的身份验证
我开始将 spring-security-core-1.1.3 插件与 grails 一起使用。 我的身份验证应用程序向服务器发送请求:
def authSomeAction = {
def req = ...//http requet here
if(req.contains("yes")){
render "There is such user"
}else{
render "There is no such user"
}
}
仅当我在客户端创建用户时,我才能使用 SpringSecurityUtils.reauthenticate(username,password) 方法成功进行身份验证
任何人都可以详细帮助我了解我必须如何实现 插件在客户端工作(没有数据库)...?
i am starting to use spring-security-core-1.1.3 plugin with grails.
My application for authentication sends request to server:
def authSomeAction = {
def req = ...//http requet here
if(req.contains("yes")){
render "There is such user"
}else{
render "There is no such user"
}
}
I can successfully authenticate using SpringSecurityUtils.reauthenticate(username, password) method only if i have created users in client side
Can anybody please in details help me to understand how i have to implement
plugin work in client side(without database)...?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对 Grails 很陌生,所以我显然可能偏离了基础,但我怀疑您的问题可能与您在创建用户时编码密码的方式有关。当您使用“客户端”创建用户时,您是否这样做与您使用的其他方法相同?
例如,当我第一次开始使用 spring-security-ui 插件时,我使用捆绑的实用程序创建了用户,但他们都无法登录。如果我理解正确,则 spring-security-core 自 spring-security 以来已更新-ui,它将控制器中对密码进行编码的需要转移到了用户本身中。例如,在该插件附带的 spring-security-ui UserController.save() 中,会发生这种情况:
但是我的 User 类有这个(直接来自 s2 插件示例)
由于我的 User 类自行管理编码,因此有一个双重编码导致使用它创建的登录失败。您的应用程序中是否存在类似的情况?当您从客户端以外的地方创建用户时,您是否以相同的方式进行编码?
I am quite new to Grails, so I could clearly be way off base, but I suspect that your issue may have to do with the way that you are encoding the password upon user creation. Are you doing it the same when you create users using the "client side" vs. what other method you are using?
For example, when I first started using the spring-security-ui plugin, I created users with the utility that is bundled and they all failed to log in. If I understand properly, the spring-security-core was updated since spring-security-ui, which has shifted the need to encode the password in the controllers to within the User itself. For example, in the spring-security-ui UserController.save() that comes with that plugin, this occurs:
But my User class then has this (straight from the s2 plugin examples)
Since my User class manages encoding itself, there was a double-encoding going which was causing the logins to fail that were created with it. Could there be something similar to this going on in your application? When you are creating users other than from the client side, are you encoding the same way?