网易云信的短信验证

This commit is contained in:
shimingxy
2020-04-13 01:24:35 +08:00
parent 944d806747
commit 710299b78f
21 changed files with 921 additions and 657 deletions

View File

@@ -12,6 +12,7 @@ import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import org.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService;
import org.maxkey.authn.support.wsfederation.WsFederationConstants;
import org.maxkey.config.ApplicationConfig;
import org.maxkey.crypto.password.opt.AbstractOptAuthn;
import org.maxkey.dao.service.UserInfoService;
import org.maxkey.domain.UserInfo;
import org.maxkey.util.StringUtils;
@@ -69,6 +70,11 @@ public class LoginEndpoint {
@Autowired
@Qualifier("authenticationProvider")
RealmAuthenticationProvider authenticationProvider ;
@Autowired
@Qualifier("tfaOptAuthn")
protected AbstractOptAuthn tfaOptAuthn;
/*
@Autowired
@Qualifier("jwtLoginService")
@@ -124,6 +130,11 @@ public class LoginEndpoint {
modelAndView.addObject("isRemeberMe", applicationConfig.getLoginConfig().isRemeberMe());
modelAndView.addObject("isKerberos", applicationConfig.getLoginConfig().isKerberos());
modelAndView.addObject("isOneTimePwd", applicationConfig.getLoginConfig().isOneTimePwd());
if(applicationConfig.getLoginConfig().isOneTimePwd()) {
modelAndView.addObject("optType", tfaOptAuthn.getOptType());
modelAndView.addObject("optInterval", tfaOptAuthn.getInterval());
}
if( applicationConfig.getLoginConfig().isKerberos()){
modelAndView.addObject("userDomainUrlJson", kerberosService.buildKerberosProxys());
@@ -183,4 +194,18 @@ public class LoginEndpoint {
return authnType;
}
@RequestMapping("/login/otp/{username}")
@ResponseBody
public String produceOtp(@PathVariable("username") String username) {
UserInfo userInfo = new UserInfo();
userInfo.setUsername(username);
UserInfo queryUserInfo=userInfoService.loadByUsername(username);//(userInfo);
if(queryUserInfo!=null) {
tfaOptAuthn.produce(queryUserInfo);
return "ok";
}
return "fail";
}
}