spring - Updating a user's token authorizations for a REST API -
i have rest api, secured spring security. when user sends request /login endpoint proper login form data (including username , password), user authenticated , token returned. token contains authorizations determined user @ login process based on data in database.
i want update authorizations in user's token based on changes on server grant user more or less access, i.e. admin makes change in db or external party signals payment received, , user allowed acces more (or less) endpoints.
how can update client's token based on changes in backend without having go through calculating users permissions each time he/she makes request rest api?
example
user logs in , receives token authorization called 'create_todo' based on value in db. endpoint create new todo item (/todo) checks request header token 'create_todo' authorization. in case user allowed create new todo item. meanwhile admin decides user no longer allowed create todo's, updates db. if user log in after admin made change, user token without 'create_todo' authorization, whowever, because user logged in, still has token 'create_todo' authorization. how can force refresh of users token based on admin's change?
Comments
Post a Comment