IpRegion IP地址转换为行政区域

Ip138 ,Ip360 ,Ipchaxun ,Ipcn ,Pconline & Local
This commit is contained in:
MaxKey
2022-03-01 19:24:05 +08:00
parent 9a3fe2ba35
commit 13102d53b7
32 changed files with 604 additions and 73 deletions

View File

@@ -228,6 +228,10 @@ public class RealmAuthenticationProvider extends AbstractAuthenticationProvider
WebContext.setAuthentication(authenticationToken);
WebContext.setAttribute(WebConstants.CURRENT_USER_SESSION_ID, currentUserSessionId);
if(!WebContext.getInst(WebContext.getRequest()).equalsIgnoreCase(userInfo.getInstId())){
//TODO :
}
return authenticationToken;
}

View File

@@ -34,6 +34,7 @@ import org.maxkey.persistence.service.UserInfoService;
import org.maxkey.util.DateUtils;
import org.maxkey.web.WebConstants;
import org.maxkey.web.WebContext;
import org.maxkey.web.ipregion.IpRegionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -49,8 +50,6 @@ public abstract class AbstractAuthenticationRealm {
protected JdbcTemplate jdbcTemplate;
protected boolean provisioning;
protected PasswordPolicyValidator passwordPolicyValidator;
protected LoginRepository loginRepository;
@@ -136,7 +135,7 @@ public abstract class AbstractAuthenticationRealm {
HistoryLogin historyLogin = new HistoryLogin();
historyLogin.setSessionId(WebContext.genId());
historyLogin.setSessionStatus(7);
if(WebContext.getAttribute(WebConstants.CURRENT_USER_SESSION_ID) !=null) {
if(WebContext.getAttribute(WebConstants.CURRENT_USER_SESSION_ID) != null) {
historyLogin.setSessionStatus(1);
historyLogin.setSessionId(WebContext.getAttribute(WebConstants.CURRENT_USER_SESSION_ID).toString());
}
@@ -150,6 +149,8 @@ public abstract class AbstractAuthenticationRealm {
historyLogin.setBrowser(browser.getName());
historyLogin.setPlatform(browser.getPlatform());
historyLogin.setSourceIp(userInfo.getLastLoginIp());
historyLogin.setIpRegion(IpRegionFactory.getFactory().region(userInfo.getLastLoginIp()));
historyLogin.setIpLocation(IpRegionFactory.getFactory().getLocation(historyLogin.getIpRegion()));
historyLogin.setProvider(provider);
historyLogin.setCode(code);
historyLogin.setLoginType(type);