onetimepwd

This commit is contained in:
MaxKey
2021-02-16 08:47:16 +08:00
parent 74d96c2d44
commit 99a4fd879c
33 changed files with 63 additions and 61 deletions

View File

@@ -22,11 +22,11 @@ import java.util.HashMap;
import org.maxkey.authn.online.OnlineTicketServices;
import org.maxkey.authn.realm.AbstractAuthenticationRealm;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import org.maxkey.configuration.ApplicationConfig;
import org.maxkey.constants.ConstantsLoginType;
import org.maxkey.crypto.password.PasswordReciprocal;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.domain.UserInfo;
import org.maxkey.web.WebConstants;
import org.maxkey.web.WebContext;

View File

@@ -22,9 +22,9 @@ import java.util.ArrayList;
import org.maxkey.authn.online.OnlineTicket;
import org.maxkey.authn.online.OnlineTicketServices;
import org.maxkey.authn.realm.AbstractAuthenticationRealm;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import org.maxkey.configuration.ApplicationConfig;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.domain.UserInfo;
import org.maxkey.web.WebConstants;
import org.maxkey.web.WebContext;

View File

@@ -27,6 +27,7 @@ import org.maxkey.authn.online.InMemoryOnlineTicketServices;
import org.maxkey.authn.online.OnlineTicketServices;
import org.maxkey.authn.online.RedisOnlineTicketServices;
import org.maxkey.authn.realm.AbstractAuthenticationRealm;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import org.maxkey.authn.support.rememberme.InMemoryRemeberMeService;
import org.maxkey.authn.support.rememberme.RedisRemeberMeService;
@@ -39,7 +40,6 @@ import org.maxkey.crypto.password.NoOpPasswordEncoder;
import org.maxkey.crypto.password.MessageDigestPasswordEncoder;
import org.maxkey.crypto.password.SM3PasswordEncoder;
import org.maxkey.crypto.password.StandardPasswordEncoder;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.persistence.db.PasswordPolicyValidator;
import org.maxkey.persistence.redis.RedisConnectionFactory;
import org.slf4j.Logger;

View File

@@ -15,10 +15,10 @@
*/
package org.maxkey.crypto.password.otp;
package org.maxkey.authn.support.onetimepwd;
import org.maxkey.crypto.password.otp.token.AbstractOtpTokenStore;
import org.maxkey.crypto.password.otp.token.InMemoryOtpTokenStore;
import org.maxkey.authn.support.onetimepwd.token.AbstractOtpTokenStore;
import org.maxkey.authn.support.onetimepwd.token.InMemoryOtpTokenStore;
import org.maxkey.domain.UserInfo;
import org.maxkey.util.StringGenerator;
import org.slf4j.Logger;

View File

@@ -15,7 +15,7 @@
*/
package org.maxkey.crypto.password.otp.algorithm;
package org.maxkey.authn.support.onetimepwd.algorithm;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

View File

@@ -15,7 +15,7 @@
*/
package org.maxkey.crypto.password.otp.algorithm;
package org.maxkey.authn.support.onetimepwd.algorithm;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

View File

@@ -15,7 +15,7 @@
*/
package org.maxkey.crypto.password.otp.algorithm;
package org.maxkey.authn.support.onetimepwd.algorithm;
public class KeyUriFormat {

View File

@@ -15,7 +15,7 @@
*/
package org.maxkey.crypto.password.otp.algorithm;
package org.maxkey.authn.support.onetimepwd.algorithm;
import java.util.Arrays;
import java.util.Random;

View File

@@ -15,7 +15,7 @@
*/
package org.maxkey.crypto.password.otp.algorithm;
package org.maxkey.authn.support.onetimepwd.algorithm;
import java.lang.reflect.UndeclaredThrowableException;
import java.math.BigInteger;

View File

@@ -15,9 +15,9 @@
*/
package org.maxkey.crypto.password.otp.impl;
package org.maxkey.authn.support.onetimepwd.impl;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.domain.UserInfo;
/**

View File

@@ -15,12 +15,12 @@
*/
package org.maxkey.crypto.password.otp.impl;
package org.maxkey.authn.support.onetimepwd.impl;
import org.apache.commons.codec.binary.Hex;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.authn.support.onetimepwd.algorithm.TimeBasedOTP;
import org.maxkey.crypto.Base32Utils;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.crypto.password.otp.algorithm.TimeBasedOTP;
import org.maxkey.domain.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -15,13 +15,14 @@
*/
package org.maxkey.crypto.password.otp.impl;
package org.maxkey.authn.support.onetimepwd.impl;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.authn.support.onetimepwd.algorithm.HOTP;
import org.maxkey.crypto.Base32Utils;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.crypto.password.otp.algorithm.HOTP;
import org.maxkey.domain.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -15,14 +15,14 @@
*/
package org.maxkey.crypto.password.otp.impl;
package org.maxkey.authn.support.onetimepwd.impl;
import java.text.MessageFormat;
import org.apache.commons.mail.DefaultAuthenticator;
import org.apache.commons.mail.Email;
import org.apache.commons.mail.SimpleEmail;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.configuration.EmailConfig;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.domain.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -15,9 +15,9 @@
*/
package org.maxkey.crypto.password.otp.impl;
package org.maxkey.authn.support.onetimepwd.impl;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.domain.UserInfo;
public class MobileOtpAuthn extends AbstractOtpAuthn {

View File

@@ -15,9 +15,9 @@
*/
package org.maxkey.crypto.password.otp.impl;
package org.maxkey.authn.support.onetimepwd.impl;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.domain.UserInfo;
/**

View File

@@ -15,12 +15,13 @@
*/
package org.maxkey.crypto.password.otp.impl;
package org.maxkey.authn.support.onetimepwd.impl;
import java.io.IOException;
import java.util.Properties;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.constants.ConstantsProperties;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.domain.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -15,16 +15,16 @@
*/
package org.maxkey.crypto.password.otp.impl;
package org.maxkey.authn.support.onetimepwd.impl;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import org.apache.commons.codec.binary.Hex;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.authn.support.onetimepwd.algorithm.TimeBasedOTP;
import org.maxkey.crypto.Base32Utils;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.crypto.password.otp.algorithm.TimeBasedOTP;
import org.maxkey.domain.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -15,7 +15,7 @@
*/
package org.maxkey.crypto.password.otp.impl.sms;
package org.maxkey.authn.support.onetimepwd.impl.sms;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
@@ -26,7 +26,7 @@ import com.aliyuncs.profile.DefaultProfile;
import java.io.IOException;
import org.maxkey.crypto.password.otp.impl.SmsOtpAuthn;
import org.maxkey.authn.support.onetimepwd.impl.SmsOtpAuthn;
import org.maxkey.domain.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -15,7 +15,7 @@
*/
package org.maxkey.crypto.password.otp.impl.sms;
package org.maxkey.authn.support.onetimepwd.impl.sms;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
@@ -26,7 +26,7 @@ import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse;
import java.io.IOException;
import org.maxkey.crypto.password.otp.impl.SmsOtpAuthn;
import org.maxkey.authn.support.onetimepwd.impl.SmsOtpAuthn;
import org.maxkey.domain.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -15,7 +15,7 @@
*/
package org.maxkey.crypto.password.otp.impl.sms;
package org.maxkey.authn.support.onetimepwd.impl.sms;
import java.io.IOException;
import java.util.ArrayList;
@@ -29,7 +29,7 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.maxkey.crypto.password.otp.impl.SmsOtpAuthn;
import org.maxkey.authn.support.onetimepwd.impl.SmsOtpAuthn;
import org.maxkey.domain.UserInfo;
import org.maxkey.util.JsonUtils;
import org.maxkey.util.StringGenerator;

View File

@@ -15,7 +15,7 @@
*/
package org.maxkey.crypto.password.otp.token;
package org.maxkey.authn.support.onetimepwd.token;
import org.ehcache.UserManagedCache;
import org.ehcache.config.builders.ExpiryPolicyBuilder;
@@ -23,8 +23,8 @@ import org.ehcache.config.builders.UserManagedCacheBuilder;
import org.joda.time.DateTime;
import org.joda.time.Duration;
import org.joda.time.format.DateTimeFormat;
import org.maxkey.authn.support.onetimepwd.OneTimePassword;
import org.maxkey.constants.ConstantsTimeInterval;
import org.maxkey.crypto.password.otp.OneTimePassword;
import org.maxkey.domain.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -15,11 +15,11 @@
*/
package org.maxkey.crypto.password.otp.token;
package org.maxkey.authn.support.onetimepwd.token;
import org.joda.time.DateTime;
import org.maxkey.authn.support.onetimepwd.OneTimePassword;
import org.maxkey.constants.ConstantsTimeInterval;
import org.maxkey.crypto.password.otp.OneTimePassword;
import org.maxkey.domain.UserInfo;
import org.maxkey.persistence.redis.RedisConnection;
import org.maxkey.persistence.redis.RedisConnectionFactory;

View File

@@ -21,9 +21,9 @@ package org.maxkey.otp.algorithm;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import org.maxkey.authn.support.onetimepwd.algorithm.HOTP;
import org.maxkey.authn.support.onetimepwd.algorithm.HmacOTP;
import org.maxkey.crypto.Base32Utils;
import org.maxkey.crypto.password.otp.algorithm.HOTP;
import org.maxkey.crypto.password.otp.algorithm.HmacOTP;
public class HmacOTPTest {

View File

@@ -19,7 +19,7 @@ package org.maxkey.otp.algorithm;
import java.io.File;
import org.maxkey.crypto.password.otp.algorithm.KeyUriFormat;
import org.maxkey.authn.support.onetimepwd.algorithm.KeyUriFormat;
import org.maxkey.util.QRCode;
import com.google.zxing.BarcodeFormat;

View File

@@ -24,9 +24,9 @@ import java.util.Date;
import java.util.TimeZone;
import org.apache.commons.codec.binary.Hex;
import org.maxkey.authn.support.onetimepwd.algorithm.TimeBasedOTP;
import org.maxkey.crypto.Base32Utils;
import org.maxkey.crypto.HexUtils;
import org.maxkey.crypto.password.otp.algorithm.TimeBasedOTP;
/**
* goole
* @author Crystal.Sea

View File

@@ -25,7 +25,6 @@ import org.maxkey.authz.oauth2.provider.token.store.InMemoryTokenStore;
import org.maxkey.authz.oauth2.provider.token.store.JdbcTokenStore;
import org.maxkey.authz.oauth2.provider.token.store.RedisTokenStore;
import org.maxkey.constants.ConstantsProperties;
import org.maxkey.crypto.password.otp.impl.TimeBasedOtpAuthn;
import org.maxkey.jobs.DynamicGroupsJob;
import org.maxkey.persistence.db.LoginHistoryService;
import org.maxkey.persistence.db.LoginService;
@@ -42,6 +41,7 @@ import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerBuilder;
import org.maxkey.authn.realm.jdbc.JdbcAuthenticationRealm;
import org.maxkey.authn.support.onetimepwd.impl.TimeBasedOtpAuthn;
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -27,18 +27,18 @@ import org.maxkey.authn.realm.activedirectory.ActiveDirectoryAuthenticationRealm
import org.maxkey.authn.realm.activedirectory.ActiveDirectoryServer;
import org.maxkey.authn.support.kerberos.KerberosProxy;
import org.maxkey.authn.support.kerberos.RemoteKerberosService;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.authn.support.onetimepwd.algorithm.KeyUriFormat;
import org.maxkey.authn.support.onetimepwd.impl.MailOtpAuthn;
import org.maxkey.authn.support.onetimepwd.impl.SmsOtpAuthn;
import org.maxkey.authn.support.onetimepwd.impl.TimeBasedOtpAuthn;
import org.maxkey.authn.support.onetimepwd.impl.sms.SmsOtpAuthnAliyun;
import org.maxkey.authn.support.onetimepwd.impl.sms.SmsOtpAuthnTencentCloud;
import org.maxkey.authn.support.onetimepwd.impl.sms.SmsOtpAuthnYunxin;
import org.maxkey.authn.support.onetimepwd.token.RedisOtpTokenStore;
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import org.maxkey.constants.ConstantsPersistence;
import org.maxkey.constants.ConstantsProperties;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.crypto.password.otp.algorithm.KeyUriFormat;
import org.maxkey.crypto.password.otp.impl.MailOtpAuthn;
import org.maxkey.crypto.password.otp.impl.SmsOtpAuthn;
import org.maxkey.crypto.password.otp.impl.TimeBasedOtpAuthn;
import org.maxkey.crypto.password.otp.impl.sms.SmsOtpAuthnAliyun;
import org.maxkey.crypto.password.otp.impl.sms.SmsOtpAuthnTencentCloud;
import org.maxkey.crypto.password.otp.impl.sms.SmsOtpAuthnYunxin;
import org.maxkey.crypto.password.otp.token.RedisOtpTokenStore;
import org.maxkey.persistence.db.LoginHistoryService;
import org.maxkey.persistence.db.LoginService;
import org.maxkey.persistence.db.PasswordPolicyValidator;

View File

@@ -20,7 +20,7 @@ package org.maxkey.web.contorller;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
import org.maxkey.domain.UserInfo;
import org.maxkey.persistence.service.UserInfoService;
import org.maxkey.web.WebConstants;

View File

@@ -20,10 +20,10 @@ package org.maxkey.web.contorller;
import java.awt.image.BufferedImage;
import java.util.UUID;
import org.apache.commons.codec.binary.Hex;
import org.maxkey.authn.support.onetimepwd.algorithm.KeyUriFormat;
import org.maxkey.authn.support.onetimepwd.algorithm.OtpSecret;
import org.maxkey.crypto.Base32Utils;
import org.maxkey.crypto.password.PasswordReciprocal;
import org.maxkey.crypto.password.otp.algorithm.KeyUriFormat;
import org.maxkey.crypto.password.otp.algorithm.OtpSecret;
import org.maxkey.domain.UserInfo;
import org.maxkey.persistence.service.UserInfoService;
import org.maxkey.util.RQCodeUtils;

View File

@@ -27,12 +27,12 @@ import javax.servlet.http.HttpServletResponse;
import org.maxkey.authn.AbstractAuthenticationProvider;
import org.maxkey.authn.LoginCredential;
import org.maxkey.authn.support.kerberos.KerberosService;
import org.maxkey.authn.support.onetimepwd.AbstractOtpAuthn;
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.configuration.ApplicationConfig;
import org.maxkey.constants.ConstantsStatus;
import org.maxkey.crypto.password.otp.AbstractOtpAuthn;
import org.maxkey.domain.UserInfo;
import org.maxkey.persistence.service.UserInfoService;
import org.maxkey.util.StringUtils;