Creating a custom UserDetailsService object

While we are able to link our domain model (CalendarUser) with Spring Security's domain model (UserDetails), we have to maintain multiple representations of the user. To resolve this dual maintenance, we can implement a custom UserDetailsService object to translate our existing CalendarUser domain model into an implementation of Spring Security's UserDetails interface. By translating our CalendarUser object into UserDetails, Spring Security can make security decisions using our custom domain model. This means that we will no longer need to manage two different representations of a user.


Up to this point, we have needed two different representations of users. One for Spring Security ...

Get Spring Security 3.1 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.