Код: Выделить всё
1) domain_1.dom (domain controller - dc.domain_1.dom:389)
2) domain_2.gu (domain controller - dc.domain_2.gu:389)
3) domain_3.rt (domain controller - dc.domain_3.rt:389)
Есть техаккаунт в домене_1.dom с чтением права во всех доменах.
С помощью стандартных инструментов Windows мы можем получать пользователей со всех доменов по этому техаккаунту:
Код: Выделить всё
$ADUser = 'tech@domain_1.dom'
$pwd_secure_string = Read-Host "password" -AsSecureString
$creds = New-Object -Typename System.Management.Automation.PSCredential -ArgumentList $ADUser,$pwd_secure_string;
$DC = 'dc.domain_2.gu:389'
$SID = 'S-1-5-21-86078234-647216237-617849643-1473'
Get-ADUser -LDAPFilter "(&(objectClass=user)(objectSid=${SID}))" -Server $DC -Credential $creds
DistinguishedName : CN=Snow Andy,OU=Arctic,OU=Company,DC=domain_2,DC=gu
Enabled : True
GivenName : Andy
Name : Snow Andy
ObjectClass : user
ObjectGUID : f20133e9-c01f-4e21-ad7b-982caad6f364
SamAccountName : asnow
SID : S-1-5-21-86078234-647216237-617849643-1473
Surname : Snow
UserPrincipalName : asnow@domain_2.gu
Код Java:
Код: Выделить всё
AdInfo adInfo = adSearchInfo.getAdInfo();
String url = adInfo.getUrl(); // ldap://dc.domain_2.gu:389
AdSecrets secrets = adInfo.getSecrets();
String login = secrets.getLogin(); // tech@domain_1.dom
String password = secrets.getPassword(); // password
LdapContextSource contextSource = new LdapContextSource(); contextSource.setUrl(url);
contextSource.setUserDn(login);
contextSource.setPassword(password);
contextSource.afterPropertiesSet();
return new SingleContextSource(contextSource.getReadWriteContext());
org.springframework.ldap.AuthenticationException: [LDAP: код ошибки 49 - 80090308: LdapErr: DSID-0C09050F, комментарий: Ошибка AcceptSecurityContext, данные 52e, v4563]; вложенным исключением является javax.naming.AuthenticationException: [LDAP: код ошибки 49 - 80090308: LdapErr: DSID-0C09050F, комментарий: ошибка AcceptSecurityContext, данные 52e, v4563]
at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:191) ~[spring-ldap-core-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
at org.springframework.ldap.core.support.AbstractContextSource.createContext(AbstractContextSource.java:362) ~[spring-ldap-core-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
at org.springframework.ldap.core.support.AbstractContextSource.doGetContext(AbstractContextSource.java:146) ~[spring-ldap-core-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
at org.springframework.ldap.core.support.AbstractContextSource.getReadWriteContext(AbstractContextSource.java:181) ~[spring-ldap-core-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
Мы попытались использовать вход в техническую учетную запись в качестве полного имени: CN=tech,OU=TECH ACCOUNTS,OU=Группы доступа,DC=domain_1,DC=dom, но имеют то же исключение. Пароль абсолютно правильный.
Тех-аккаунт активен и имеет права чтения во всех доменах.
Подробнее здесь: https://stackoverflow.com/questions/792 ... nexception
Мобильная версия