r/SpringBoot • • 14d ago

Question Feedback for my first "Complete" API REST

/r/learnjava/comments/1xqheuw/feedback_for_my_first_complete_api_rest/
2 Upvotes

4 comments sorted by

2

u/Mikey-3198 14d ago

One thing I noticed from a quick glance is that you're using JWTs but still calling the database on each request.

The major selling point of JWTs is that you can remove the need to call the database on each request. If you issue the JWT with the necceasry claims to make your auth/ authz decisions you can remove the need to call the db. At the moment the jwts aren't really adding anything.

1

u/AdCharacter900 14d ago

I didnt know that! Thanks for the info

1

u/sereikis 13d ago

a database lookup on each request isn't inherently a JWT mistake: it can let Spring Security reject a disabled account or use current roles instead of stale token claims. if you move those checks entirely into the token, test what happens when an account is disabled or a role is removed before that token expires.

1

u/AdCharacter900 13d ago

Thanks for the info!