Refreshing claims without refreshing token

纵然是瞬间 提交于 2020-01-23 12:26:09

问题


We are using IdentityServer3 to authenticate our users. We run it on a separate web application to the main application API. There is a hierarchy of claims - for example, sites, factories and equipment. It is possible for a user to have a claim for a piece of equipment that is at a factory, but not have a claim for the entire factory, or the site.

The distribution of claims is handled by means of a background job.

When a user creates a site, factory or equipment a claim is created for them, this may have also been distributed to other users.

When a request comes into the engine API we need to be sure we're looking at the most up to date set of claims for the current user.

Is there any way to guarantee that the most recent claims are sent to the API each time?


回答1:


If the data you need changes that frequently, then the advice is to not put them as claims in a token or in a cookie. Instead just put the user's unique id (sub claim) in the token or cookie, and then lookup the rest from the DB as needed. If perf is a problem, then do caching.



来源:https://stackoverflow.com/questions/37571337/refreshing-claims-without-refreshing-token

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!