I was struggling for days on how can I implement a switch between roles with one userAccount within a Spring Boot application via Spring Security. There is an example in my case:
I have a class [UserAccount]{Id,username,password,isActive} and [Role]{Id,roleName,description} with which I'm implementing a successful simple login system with some @Secured RESTful methods.
My roles are: ADMIN, TEACHER & STUDENT
Now, I want to create a class for each role (e.g. StudentUser, TeacherUser, AdminUser) or something like that, to be able to add some new attributes which are not common between all users.
For example:
How can I deal with that in a best and efficient way? Thanks.