captcha config

This commit is contained in:
MaxKey
2022-02-25 14:34:55 +08:00
parent eb0d1e128e
commit 0c467a72a6
20 changed files with 405 additions and 363 deletions

View File

@@ -203,8 +203,7 @@ public abstract class AbstractAuthenticationProvider {
*/
protected void captchaValid(String captcha, String authType) {
// for basic
if (applicationConfig.getLoginConfig().isCaptcha()
&& authType.equalsIgnoreCase(AuthType.NORMAL)) {
if (authType.equalsIgnoreCase(AuthType.NORMAL)) {
_logger.info("captcha : "
+ WebContext.getSession().getAttribute(
WebConstants.KAPTCHA_SESSION_KEY).toString());

View File

@@ -24,6 +24,7 @@ import org.maxkey.authn.online.OnlineTicketServices;
import org.maxkey.authn.realm.AbstractAuthenticationRealm;
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import org.maxkey.configuration.ApplicationConfig;
import org.maxkey.entity.Institutions;
import org.maxkey.entity.UserInfo;
import org.maxkey.password.onetimepwd.AbstractOtpAuthn;
import org.maxkey.password.onetimepwd.OtpAuthnService;
@@ -84,8 +85,11 @@ public class RealmAuthenticationProvider extends AbstractAuthenticationProvider
//jwtTokenValid(j_jwtToken);
authTypeValid(loginCredential.getAuthType());
captchaValid(loginCredential.getCaptcha(),loginCredential.getAuthType());
Institutions inst = (Institutions)WebContext.getAttribute(WebConstants.CURRENT_INST);
if(inst.getCaptcha().equalsIgnoreCase("YES")) {
captchaValid(loginCredential.getCaptcha(),loginCredential.getAuthType());
}
emptyPasswordValid(loginCredential.getPassword());