spring-ldap icon indicating copy to clipboard operation
spring-ldap copied to clipboard

SimpleDirContextAuthenticationStrategy and DefaultSpringSecurityContextSource should accept SSLSocketFactory

Open marschall opened this issue 5 years ago • 4 comments

In order to support custom truststores more SSL configuration SimpleDirContextAuthenticationStrategy and DefaultSpringSecurityContextSource should accept a SSLSocketFactory.

This is a follow up for #494

marschall avatar Jan 08 '20 14:01 marschall

This would be very helpful.

jakub-moravec avatar Feb 17 '21 11:02 jakub-moravec

Hi, @marschall. I can see how this would be nice, but I'm not sure the underlying Java API supports it since ultimately the DirContext environment wants a class name, not a fully-constructed class in the java.naming.ldap.factory.socket environment property.

Is there a way that SimpleDirContextAuthenticationStrategy and DefaultSpringSecurityContextSource could accept a fully-constructed SSLSocketFactory?

jzheaux avatar Feb 23 '22 21:02 jzheaux

Hi, @marschall. I can see how this would be nice, but I'm not sure the underlying Java API supports it since ultimately the DirContext environment wants a class name, not a fully-constructed class in the java.naming.ldap.factory.socket environment property.

Yes, that's a problem. There is discussion about this in #547. For a possible solution see https://github.com/marschall/ssl-socket-factory-factory-bean.

marschall avatar Feb 24 '22 12:02 marschall

@marschall, sorry, I'm still not quite seeing how the factory bean helps in this situation. It may help in others, but in the cases listed in this ticket, the Java API asks for a class name. Having a factory construct the object still doesn't help since Java doesn't allow for specifying socket factory instances.

Does it sound like I'm missing something? If so, maybe it would help if you shared a code snippet of how DefaultSpringSecurityContextSource should change.

jzheaux avatar Mar 01 '22 22:03 jzheaux