Spring Security(Third Edition)
上QQ阅读APP看书,第一时间看更新

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.