subdivide web api authorization in machine to machine scenario

时间:2016-04-21 22:44:34

标签: identityserver3

I need advice coming up with the proper configuration for a scenario using IdentiyServer.

The scenario is machine to machine communication. A single web api is divided into two parts. One part allows notifications to be posted into it (write). The second allows information to be queried from it (read).

I envision protecting endpoints with something like [Authorize("Write")] and [Authorize("Read")]. From what I can tell, scopes are API wide... if they can be used to clarify access in this way, I haven't figured it out... or its too simple for my brain.

Suggestions?

1 个答案:

答案 0 :(得分:2)

范围可以在比应用程序范围更精细的级别使用。只需在API中针对该API所需的范围进行正常声明检查。

也许这样的事情可行:https://github.com/IdentityModel/Thinktecture.IdentityModel/blob/master/source/WebApi.ScopeAuthorization/ScopeAuthorizeAttribute.cs