LDAP同步和登录问题

decoder credentials
This commit is contained in:
MaxKey
2022-03-03 20:35:19 +08:00
parent 8f9c5dad08
commit 7944b16bd1
5 changed files with 56 additions and 32 deletions

View File

@@ -149,8 +149,9 @@ 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()));
//TODO:
//historyLogin.setIpRegion(IpRegionFactory.getFactory().region(userInfo.getLastLoginIp()));
//historyLogin.setIpLocation(IpRegionFactory.getFactory().getLocation(historyLogin.getIpRegion()));
historyLogin.setProvider(provider);
historyLogin.setCode(code);
historyLogin.setLoginType(type);

View File

@@ -21,6 +21,7 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
import org.maxkey.authn.realm.IAuthenticationServer;
import org.maxkey.crypto.password.PasswordReciprocal;
import org.maxkey.entity.LdapContext;
import org.maxkey.persistence.ldap.ActiveDirectoryUtils;
import org.maxkey.persistence.ldap.LdapUtils;
@@ -57,7 +58,8 @@ public class LdapAuthenticationRealmService {
ActiveDirectoryUtils ldapUtils = new ActiveDirectoryUtils(
ldapContext.getProviderUrl(),
ldapContext.getPrincipal(),
ldapContext.getCredentials(),
PasswordReciprocal.getInstance().decoder(
ldapContext.getCredentials()),
ldapContext.getMsadDomain());
ldapServer.setActiveDirectoryUtils(ldapUtils);
if(ldapContext.getAccountMapping().equalsIgnoreCase("YES")) {
@@ -70,7 +72,8 @@ public class LdapAuthenticationRealmService {
LdapUtils ldapUtils = new LdapUtils(
ldapContext.getProviderUrl(),
ldapContext.getPrincipal(),
ldapContext.getCredentials(),
PasswordReciprocal.getInstance().decoder(
ldapContext.getCredentials()),
ldapContext.getBasedn());
standardLdapServer.setLdapUtils(ldapUtils);
standardLdapServer.setFilterAttribute(ldapContext.getFilters());