简体   繁体   中英

JCIFS authenticate with hashed password

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM