I'm using spring-security LDAP to authenticate a user in my application. I want to access a samba share with the authenticated user's credentials. I use the JCIFS library: http://jcifs.samba.org/.
Getting the UserDetails from SecurityContextHolder.getContext().getAuthentication().getPrincipal();
gives me only the hashed (SHAA) password of the user. Is it possible to use this hash to authenticate JCIFS instead of the plain text password?
I couldn't get it working with hashed password, but for my usecase, spring security provides configuration to keep the plain password:
<authentication-manager erase-credentials="false">
With this configured, you can get the password by:
(String) SecurityContextHolder.getContext().getAuthentication().getCredentials();