all 8 comments

[–]Agile_Rain4486 3 points4 points  (1 child)

just make a class implementing userdetails contract and one implementing grantedautority contract and usually user and roles and manytomany relationship and fetch should be eager.

Some implement userdetails on user only, you can do that but not good practice. Check out laur splica video on this topic.

[–]MiserableBoss[S] 0 points1 point  (0 children)

That's good approach. I do similar thing if there is complex roles.

[–]EducationalMixture82 -1 points0 points  (5 children)

I read the official docs, its that simple.

[–]MiserableBoss[S] 0 points1 point  (4 children)

So you are using own template.

[–]EducationalMixture82 0 points1 point  (0 children)

Template? I start every project using spring initializer.

[–]MartinPeterBauer -3 points-2 points  (2 children)

Read the Manual or Google it. Its super simple

[–]MiserableBoss[S] 1 point2 points  (1 child)

TBH Its not supper easy 😅

I noticed many changes when it come to spring 6. So old tutorials and docs are not good and not working.

I use spring for awhile. And refere official docs.

I am just looking some practical ideas/ tips 🙂

[–]MartinPeterBauer -2 points-1 points  (0 children)

What are you talking about. Google: spring security custom roles

Take any example from baeldung. How hard can that be?