Spring Boot Security Role-based Authorization Tutorial

preview_player
Показать описание
Learn to use Spring Security to authorize users based on their roles (authorities) for a Spring Boot application. The credentials and authority are stored in MySQL database. Spring Data JPA with Hibernate is used for the data access layer. Thymeleaf is used for the view templates.

Here's what you will learn:
- Create tables in MySQL to store credentials and roles.
- Declare dependencies for Spring Security, Spring Data JPA, MySQL JDBC driver and Thymeleaf integration with Spring Secrity.
- Configure data source
- Code User & Role model classes.
- Code UserRepository interface.
- Implement UserDetails & UserDetailsService interfaces.
- Configure authentication & authorization

#springsecurity #springboot #springmvc #springframework #javaprogramming
Рекомендации по теме
Комментарии
Автор

I've watched many spring security tutorials but as is expected everyday yours is the best 👍 keep going

Aoubaker
Автор

Thank you so much! This video & earlier CRUD using Thymeleaf really helped me! Excellent teachings by you.

ShubhDevotional
Автор

Thank you for this amazing well detailled tutorial .
Can you please indicate the video that you made before it?! Where you started the project exactely

fatimadonwannasay
Автор

Great video But what can we do if admin want to create a new role such as staff and grant permission for that role, for example, a staff can only view and create product ? we have to go to the configure method in WebSecurityConfig class in order to add staff role to the code or there are any other ways to solve that problem ?

bathientran
Автор

Hi Sir U r simple a gem of Java Technologies. Very Long 6 months i Ma following ur website and your vidoes. I have a very small request. xab u plz rearrange all the videos with serial number infront so that we can learn the development process and learn Spring boot + Spring Security in a resonable order. Hope you will and rearrange in your youtube video channel. Thanks in advance. 👌👍😀

earthcitizen
Автор

anh ơi cho em hỏi.
Em có 5 bảng: user, user_role, role, permission(có field url), permission_role.
Làm sao để em phân quyền theo url ở bảng permission trong Database của mình ạ?
Và url này có thể sửa đổi tùy ý chứ không xét cứng ạ.

tuandinh
Автор

Hello, You did not mention the product table entities and customer which we can found by following entities, if you clear this more for the beginner it would be very easy and well understanding, another thing is that you have showed in video tutorial which is different text based tutorial, is it good but for beginners it should have made more easy i think, lot of thanks for your outstanding effort to make this tutorial for us. Many Many thanks sir.

learningwith_naymulislam
Автор

really nice
just seems like while watching the video my mind says i have e question how to do this way but within few minutes in the video got the answer every time hahaha .

MahadiHasan-qbzw
Автор

thanks for made this tutorial easy to understand

juancaos
Автор

Thanks much for this tutorial...it's really very clear explanation

deepikavijayakumar
Автор

hello, I am trying to code for frontend using react but not able to implement authentication of spring security.. any idea how to work on react with spring security for role based authorization???

vinayaktigadi
Автор

thanks this is great work, it is too much helpful!
please i got one error whent i want to secure my my links weither user is connecting as ADMIN or USER.. so if user connect to my website i want to hide some links and if it is ADMIN then it can see all link ... but when i try what you did in tutuorial all the links are hiden weither it is ADMIN or not ALL those link are hiden... please help.. those link are in my navigation bar

luctandoum
Автор

The tutorials come in very handy. Is it necessary to include a dto interface in e-commerce app? If so, how do you implement it in the app? Any tutorials about this? Thanks in advance.

De_Bryan
Автор

Nice tutorials. They come in very handy. I am building a project and realized that the websecurityco figurer has been deprecated. Which versions did you use in the tutorials/ can you offer a solution to this issue? Will b more than happy.

De_Bryan
Автор

Hello Code Java Author,
Loved your videos they have so much information and infact im using ur video knowledge for one of my college projects.The only issue is how can we create a registration form for this video? It would really mean alot if u could provide us with it as u have given a registration form code and explanation in your other video. Thanks :) Waiting for your quick response.

neeldhotre
Автор

it was great, is it possible if you make video on how to add permission like read write to each role: thanks

abasrafiq
Автор

Hey, awesome tutorial!!!
Question:
I listed all the users with the help of your other tutorial. Now I like to list the roles of these users as well (if logged in as admin). I tried it with:
<td sec:authorize="hasAnyAuthority('CREATOR', 'ADMIN')">
<a </td>


Can you help me out?

F.Jagger
Автор

@Code Java just Subscribed! :) do you have the .sql file please? thank you so much

sample-obrt
Автор

I got the following error:

: An internal error occurred while trying to authenticate the user.

class java.lang.String cannot be cast to class (java.lang.String is in module java.base of loader 'bootstrap';

romscott
Автор

Nice tutorial.. but did you use hibernate mapping in this?

kundaladivya
visit shbcf.ru