bdeg
11/29/2018, 5:32 PMdiesieben07
11/29/2018, 5:35 PMUserDetailsService
is the simplest of them all and what I would recommend. You can have your domain object impmenent UserDetails
and then return it from your UserDetailsService
, it will then be accessible from anywhere from the Authentication
object (Authentication#principal
will contain your UserDetails
implementation).bdeg
11/29/2018, 5:41 PMJukka Siivonen
11/29/2018, 5:41 PMJukka Siivonen
11/29/2018, 5:42 PMdiesieben07
11/29/2018, 5:42 PMDaoAuthenticationProvider
automatically if you have UserDetailsService
, or you can do that yourself.diesieben07
11/29/2018, 5:43 PMUserDetailsService
is fine, then you can let Spring handle all the validation (correct password, is locked or not, etc.)bdeg
11/29/2018, 5:43 PMbdeg
11/29/2018, 5:46 PMJukka Siivonen
11/29/2018, 5:48 PMbdeg
11/29/2018, 5:48 PMJukka Siivonen
11/29/2018, 5:56 PMJukka Siivonen
11/29/2018, 5:57 PMdiesieben07
11/29/2018, 6:58 PMgetAuthorities
on Authorization
will return the authorities from the UserDetails
if you have the correct AuthenticationProvider.Jukka Siivonen
11/29/2018, 7:17 PMdiesieben07
11/29/2018, 7:25 PMAbstractUserDetailsAuthenticationProvider
will create a UsernamePasswordAuthenticationToken
as the Authentication
, which takes it's authorities from the UserDetails
. DaoAuthenticationProvider
(based on UserDetailsService
) is one such providerdiesieben07
11/29/2018, 7:25 PMAuthorization
(which is not a thing) instead of Authentication
.Jukka Siivonen
11/29/2018, 7:27 PMJukka Siivonen
11/29/2018, 7:31 PMisto
12/04/2018, 5:35 PMisto
12/04/2018, 5:55 PMbdeg
12/04/2018, 10:53 PM