Creating roles and permissions from the database
We have utilized UserDetailsService and UserDetails interfaces in handling user credentials and information but the information, still came from HashMap with static data. This recipe will show us how to archive all the user credentials and information to a database to be fetched by a custom UserDetails class.
Getting started
Open the MySQL server to alter our hrs schema. Also, utilize the same project ch04 for this recipe.
How to do it...
- Before we start the main recipe, let us add the following tables in our
hrsschema:

- The
userdetailsclass will contain the usual general user information, whilelogindetailscontains theusername,password, andencrypted passwordof each user. On the other hand,role_permissioncontains all the roles and access permissions of each user inlogindetails. A Permission is defined as the allowableCRUDtransaction to be performed by a user, such asREAD,WRITE,VIEW,DELETE, andREPORT, which is different from the...