java - User details store best practies -


it possible extends org.springframework.security.core.userdetails.user , create own implementation of hold more information user, not username/password/authorities. so, can make like

public class customuser extends user {     private myentityuser user;     // getters/setters/contructor } 

and not load database user information more 1 time?

is legal? or exists palce functionality?

that's 1 of ways solve problem. java documentation, there 3 appropriate approaches:

developers may use class directly [1], subclass [2], or write own userdetails implementation scratch [3].

on 1 of projects i've picked third strategy , used following hierarchy:

class accountauthdetails extends account implements userdetails { ... } class account { ... } 

i didn't have need in org.springframework.security.core.userdetails.user then.


Comments