-
May 22nd, 2010, 04:47 AM
#1
UserDetails.getPassword
Please pardon me if the question is really stupid, but just out of need I do not want to store user password in the session-wide available userdetails implementation object.
java.lang.String getPassword()
Returns the password used to authenticate the user. Cannot return null.
Why spring-security demands password once user is authenticated?
-
May 22nd, 2010, 07:16 AM
#2
It's not a general requirement - more a legacy of the original development which gave equal priority to remote and web clients and authenticated repeatedly against a cache of user objects. There are plans to add in support (in 3.1) for the AuthenticationManager to erase credentials data after authentication.
It is also trivial to customise your AuthenticationProvider to return an object which only contains the data you require.
-
May 23rd, 2010, 12:48 AM
#3
Thanks :)
Thanks Luke for explaining. I am fairly new to spring-sec and was evaluating whether its suitable for my next project.
So can my UserDetails implementation throw an exception or any predefined string when an attempt to retrieve password is made using getPassword()?
I want to authenticate user using various mechanism like google/yahoo/facebook /LDAP auth and load its authorities from local database. After this I do not want any app-code to be able to retrieve the password that was used for authentication.
What all classes/interfaces I need to code/implement in order to achieve this. Can anyone please suggest some further reading for above requirements?
-
May 25th, 2010, 12:41 AM
#4
UserDetails.getPassword
Hi Kedi,
For customization, you have to implement 'UserDetails' interface and create your own class, having customized getPassword() method.
Hope it helps.
Thanks,
Nisha
-
Jun 2nd, 2010, 06:25 AM
#5
hi,]
request u to please paste the code.
i m trying to get password from login to jsp in loadUserByName method.
-
Jun 2nd, 2010, 06:36 AM
#6
For google, yahoo etc, you should be using OpenID (or some other protocol where you authenticate directly to the provider). Your application will never see the password.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules