C
C
Chamalion2020-11-15 14:29:37
Spring
Chamalion, 2020-11-15 14:29:37

How to implement user roles for Spring security?

I have a java spring project . How can I implement registration for users (for example, saving the login and password in the database), and also associate these users with different roles (admin, registered user, unregistered user)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2020-11-15
@azerphoenix

Hello!

add roles for users (non-user, user, admin) with their passwords and logins.

Roles do not have logins and passwords. Users have them.
The role only defines who the user is. ADMIN, USER, etc.
There is also Privilege (privilege). Those. that this user is allowed according to the role assigned to him. For example, the right to comment, the right to publish, etc.
Here, here is a visual tutorial on roles and privileges
https://www.baeldung.com/role-and-privilege-for-sp...
Here is a good course from the torrent:
https://rutracker.org/forum/viewtopic. php?t=5864776 I
recommend purchasing this course at the office. www.baeldung.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question