roles() is a User builder method for assigning roles. It creates GrantedAuthority objects and automatically adds the ROLE_ prefix to each supplied name. section 7.1.2
Assigning roles to users
Use roles("ADMIN") and roles("MANAGER"), not names containing ROLE_. Then hasRole("ADMIN") allows John to access the endpoint while Jane receives HTTP 403 Forbidden.
Figure 7.5 Roles are coarse grained. Each user with a specific role can only do the actions granted by that role. When applying this philosophy in authorization, a request is allowed based on the purpose of the user in the system. Only users who have a specific role can call a certain endpoint.
Roles provide coarse-grained authorization: each role grants access to the actions associated with a user's purpose. section 7.1.2
