我使用的是OAUTH身份验证的JHipster。我想创建一个用户,而无需用户通过电子邮件激活帐户。我修改了UserService中的代码,以为通过将resetKey和resetDate设置为NULL,用户可以登录而无需激活步骤;在activated
也被设置为true
在创建时。当前,没有激活电子邮件创建的用户将获得:
{"error":"invalid_grant","error_description":"Bad credentials"}
新用户可以登录的唯一方法是通过激活电子邮件并重置密码。
没有此步骤,有什么方法可以创建用户?是否有另一个身份验证表需要修改?
任何帮助是极大的赞赏。
编辑:
我在这里发现了错误,``''被保护的void AdditionalAuthenticationChecks(UserDetails userDetails,UsernamePasswordAuthenticationToken身份验证)抛出AuthenticationException {Object salt = null; if(this.saltSource!= null){盐= this.saltSource.getSalt(userDetails); }
if(authentication.getCredentials() == null) {
this.logger.debug("Authentication failed: no credentials provided");
throw new BadCredentialsException(this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
} else {
String presentedPassword = authentication.getCredentials().toString();
// PROBLEM IS INVALID PASSWORD!!!!
if(!this.passwordEncoder.isPasswordValid(userDetails.getPassword(), presentedPassword, salt)) {
this.logger.debug("Authentication failed: password does not match stored value");
throw new BadCredentialsException(this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
}
}
}```
由于某种原因,我的密码无效,salt为NULL!我不知道为什么会这样。我看到的密码是我用来创建用户的密码!
谢谢。
字段应为activated
和activationKey
。激活的默认值为false,请参见User.java
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句