Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization of $expand #4

Open
ItielBeeri opened this issue Dec 28, 2020 · 2 comments
Open

Authorization of $expand #4

ItielBeeri opened this issue Dec 28, 2020 · 2 comments

Comments

@ItielBeeri
Copy link

First, this is a very helpful library that is going to simplify our security implementation in the growing oData stack we maintain. Thank you!

I examined in the docs the support for authorization on navigation properties, and noticed that this works as long as these navigations are accessed through nested paths.
Is there a way to force the restrictions when entities are accessed through the $expand operator?
For example, for the URL /customers?$expand=orders I would like the user to be permitted only if they have both Customers.Read AND Orders.Read scopes.
How can this be achieved?

@mikenorgate
Copy link

@ItielBeeri I've been looking at this as we where after the same feature.

I've got together some working (or at least seems to be) code, if you want to take a look Polystream@8317da5

The problem I ran into was that the SelectExpandClause wasn't available in the middleware prior to the query actually being executed, I've work around this but it feels a little hacky at the moment
https://github.com/Polystream/WebApiAuthorization/blob/8317da557b3cc098409bc4d82d708d7fd8d98481/src/Microsoft.AspNetCore.OData.Authorization/ODataAuthorizationMiddleware.cs#L56-L60

@anton-kirschhock
Copy link

Any updates on this? Is there a permanent solution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants