Настройте плагин Grails Spring-Security-LDAP для использования startTLSJAVA

Программисты JAVA общаются здесь
Anonymous
Настройте плагин Grails Spring-Security-LDAP для использования startTLS

Сообщение Anonymous »

Можно ли настроить плагин Grails Spring-Security-LDAP для использования startTLS? : 4.0.3 < /p>
spring-security-ldap:4.0.0.m1
Я попытался настроить это в customldapcontextinitializer.groovy в src /Main/Groovy и Bean, добавленные в ресурсах. Grovy:

Код: Выделить всё

package RIMS
import org.springframework.ldap.core.support.LdapContextSource

import javax.naming.ldap.InitialLdapContext
import javax.naming.ldap.LdapContext
import javax.naming.ldap.StartTlsRequest
import javax.naming.ldap.StartTlsResponse
import javax.net.ssl.SSLSession

class CustomLdapContextInitializer {
LdapContextSource ldapContextSource

String managerDn
String managerPassword
String server
SSLSession session

void setManagerDn(managerDn){
this.managerDn = managerDn
}
void setManagerPassword(managerPassword){
this.managerPassword = managerPassword
}
void setServer(server){
this.server = server
}

CustomLdapContextInitializer(LdapContextSource ldapContextSource) {
this.ldapContextSource = ldapContextSource

this.setManagerDn(ldapContextSource.userDn)
this.setManagerPassword(ldapContextSource.password)
this.initializeContext()
}

void initializeContext() {

LdapContext ctx = (InitialLdapContext) ldapContextSource.getContext(this.managerDn, this.managerPassword)
StartTlsResponse tls = (StartTlsResponse) ctx.extendedOperation(new StartTlsRequest())
session = tls.negotiate()
}
}
< /code>
Но я получаю ошибку, когда приложение запускается: < /p>
2025-02-17 12:26:17.519  WARN --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customLdapContextInitializer': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [RIMS.CustomLdapContextInitializer]: Constructor threw exception; nested exception is javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Сертификат был добавлен в магазин ключей Java и не является сертификатом, подписанным самопозначением.

Подробнее здесь: https://stackoverflow.com/questions/794 ... e-starttls

Вернуться в «JAVA»