There is a need to log in to the site under different types of users. Teacher and pupil. These users have different @Entity and cannot be stored in the same table. Can I post their authorization data on different tables? If so, how then to specify the spring, from which table the information should be taken.

  • Are not the authorization data common? This is usually a name, password, role. This can be stored in the same table. - iksuy
  • I was given the task from different databases. Therefore, I ask the question, perhaps this is in principle impracticable? - Victor Morozov
  • I think it is doable: stackoverflow.com/questions/8686649/… - iksuy
  • Everything is possible. You can feed the spring security query, which will pull users through the UNION of two tables. You can borrow AuthenticationProvider, which generally implements any of your wishes for authorization. But storing users of different types in the form of different entities in different tables in the database - it looks like an architectural jamb. Authorization data should not be confused with business objects. - Nofate
  • You can also make different links for the teacher and student for authorization, and for each link use the SecurityContextHolder.getContext().setAuthentication() method - MrFylypenko

0