0
如何在hybris中进行不区分大小写的用户名认证?如何在hybris中进行不区分大小写的用户名认证?
如何在hybris中进行不区分大小写的用户名认证?如何在hybris中进行不区分大小写的用户名认证?
首先你必须重写DefaultCustomerFacade(在commercefacades中的文件)的注册方法。
你会发现默认的实现力小写阻止你在你的uid为大写字符 - > customer.setUid(registerData.getLogin().toLowerCase())
然后,你必须创建一个别名“acceleratorAuthenticationProvider”重写方法身份验证的新豆。
在这种方法中,你必须实现类似
final UserModel userModel = findUserCaseInsensitive(authentication.getName());
if (userModel != null)
{
usernameResult = userModel.getUid();
token = new UsernamePasswordAuthenticationToken(authentication.getName(), authentication.getCredentials());
token.setDetails(authentication.getDetails());
}
的方法findUserCaseInsensitive
应该调用将执行灵活的搜索一个DAO。 这里是一个例子:
SELECT {user.PK} FROM {User as user} WHERE lower({user.uid}) = lower(?uid)