balteo
balteo

Reputation: 24659

What are the implications of a JPA entity implementing Spring Security UserDetails?

I have a JPA entity called Member. I would like for this entity to implement Spring Security UserDetails and implement a custom JPA-based UserService.

Before doing so, I have a few points of concern that I would like to sort:

Upvotes: 2

Views: 662

Answers (1)

NimChimpsky
NimChimpsky

Reputation: 47280

impact session usage significantly?

No.

expect all its properties to remain synchronized properly when they are updated elsewhere?

No, you'll have to manage that yourself ..., ie when you update it somewhere, make sure you also update the instance in memory :

Member member = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
member.setYourField(yourValue); //

Upvotes: 2

Related Questions