mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-08 09:58:56 +08:00
otpCaptcha
This commit is contained in:
parent
a02822d0b3
commit
e31a83b679
@ -84,7 +84,7 @@ public class ImageCaptchaEndpoint {
|
||||
if(StringUtils.isNotBlank(state)
|
||||
&& !state.equalsIgnoreCase("state")
|
||||
&& authJwtService.validateJwtToken(state)) {
|
||||
//do nothing
|
||||
//just validate state Token
|
||||
}else {
|
||||
state = authJwtService.genJwt();
|
||||
}
|
||||
|
||||
@ -79,7 +79,11 @@ public class NormalAuthenticationProvider extends AbstractAuthenticationProvider
|
||||
_logger.debug("authentication " + loginCredential);
|
||||
|
||||
Institutions inst = (Institutions)WebContext.getAttribute(WebConstants.CURRENT_INST);
|
||||
if(inst.getCaptchaSupport().equalsIgnoreCase("YES")) {
|
||||
|
||||
if(this.applicationConfig.getLoginConfig().isCaptcha()) {
|
||||
captchaValid(loginCredential.getState(),loginCredential.getCaptcha());
|
||||
}
|
||||
else if(inst.getCaptchaSupport().equalsIgnoreCase("YES")) {
|
||||
captchaValid(loginCredential.getState(),loginCredential.getCaptcha());
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,9 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
public class LoginConfig {
|
||||
|
||||
@Value("${maxkey.login.captcha}")
|
||||
boolean captcha;
|
||||
|
||||
@Value("${maxkey.login.mfa}")
|
||||
boolean mfa;
|
||||
|
||||
@ -41,9 +44,15 @@ public class LoginConfig {
|
||||
public LoginConfig() {
|
||||
}
|
||||
|
||||
public boolean isCaptcha() {
|
||||
return captcha;
|
||||
}
|
||||
|
||||
public void setCaptcha(boolean captcha) {
|
||||
this.captcha = captcha;
|
||||
}
|
||||
|
||||
public boolean isKerberos() {
|
||||
public boolean isKerberos() {
|
||||
return kerberos;
|
||||
}
|
||||
|
||||
|
||||
@ -118,8 +118,12 @@ public class LoginEntryPoint {
|
||||
|
||||
Institutions inst = (Institutions)WebContext.getAttribute(WebConstants.CURRENT_INST);
|
||||
model.put("inst", inst);
|
||||
model.put("captcha", inst.getCaptchaSupport());
|
||||
model.put("captchaType", inst.getCaptchaType());
|
||||
if(applicationConfig.getLoginConfig().isCaptcha()) {
|
||||
model.put("captcha", "true");
|
||||
}else {
|
||||
model.put("captcha", inst.getCaptchaSupport());
|
||||
model.put("captchaType", inst.getCaptchaType());
|
||||
}
|
||||
model.put("state", authJwtService.genJwt());
|
||||
//load Social Sign On Providers
|
||||
model.put("socials", socialSignOnProviderService.loadSocials(inst.getId()));
|
||||
|
||||
@ -56,6 +56,8 @@ maxkey.auth.jwt.secret =7heM-14BtxjyKPuH3ITIm7q2-ps5MuB
|
||||
############################################################################
|
||||
#Login configuration #
|
||||
############################################################################
|
||||
#enable captcha
|
||||
maxkey.login.captcha =${LOGIN_CAPTCHA:false}
|
||||
#enable two factor,use one time password
|
||||
maxkey.login.mfa =${LOGIN_MFA_ENABLED:true}
|
||||
#TimeBasedOtpAuthn MailOtpAuthn SmsOtpAuthnYunxin SmsOtpAuthnAliyun SmsOtpAuthnTencentCloud
|
||||
|
||||
@ -52,6 +52,8 @@ maxkey.auth.jwt.secret =7heM-14BtxjyKPuH3ITIm7q2-ps5MuB
|
||||
############################################################################
|
||||
#Login configuration #
|
||||
############################################################################
|
||||
#enable captcha
|
||||
maxkey.login.captcha =${LOGIN_CAPTCHA:false}
|
||||
#enable two factor,use one time password
|
||||
maxkey.login.mfa =${LOGIN_MFA_ENABLED:true}
|
||||
#TimeBasedOtpAuthn MailOtpAuthn SmsOtpAuthnYunxin SmsOtpAuthnAliyun SmsOtpAuthnTencentCloud
|
||||
|
||||
@ -70,8 +70,12 @@ public class LoginEntryPoint {
|
||||
model.put("isRemeberMe", applicationConfig.getLoginConfig().isRemeberMe());
|
||||
Institutions inst = (Institutions)WebContext.getAttribute(WebConstants.CURRENT_INST);
|
||||
model.put("inst", inst);
|
||||
model.put("captcha", inst.getCaptchaSupport());
|
||||
model.put("captchaType", inst.getCaptchaType());
|
||||
if(applicationConfig.getLoginConfig().isCaptcha()) {
|
||||
model.put("captcha", "true");
|
||||
}else {
|
||||
model.put("captcha", inst.getCaptchaSupport());
|
||||
model.put("captchaType", inst.getCaptchaType());
|
||||
}
|
||||
model.put("state", authJwtService.genJwt());
|
||||
return new Message<HashMap<String , Object>>(model).buildResponse();
|
||||
}
|
||||
|
||||
@ -46,6 +46,8 @@ maxkey.auth.jwt.secret =7heM-14BtxjyKPuH3ITIm7q2-ps5MuB
|
||||
############################################################################
|
||||
#Login configuration #
|
||||
############################################################################
|
||||
#enable captcha
|
||||
maxkey.login.captcha =${LOGIN_CAPTCHA:true}
|
||||
#enable two factor,use one time password
|
||||
maxkey.login.mfa =false
|
||||
#Enable kerberos/SPNEGO
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user