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.
Creating a custom UserDetailsService object
The CalendarUserDetailsService class
Up to this point, we have needed two different...