AspNetCoreOData
AspNetCoreOData copied to clipboard
How to check custom permissions before odata query executing
Hi, i have query /odata/Clients$filter=containts And i am using JWT for authorization. I am want to get HttpContext.User before query executing and checking custom permissions (custom logic) and return
- In same cases Http401
- In same cases empty result without Http401 or exception
- In same cases my exception (my middleware processing my exception) How to do this?
@P9avel please consider using the "Discussions" tab for asking questions.
Also, from what I understand, what you need to do has nothing to do with OData: you can use the same logic as a normal MVC controller to check permissions/perform authorization.
@P9avel I think you can create a class derived from EnableQueryAttribute and override the 'OnActionExecuting', or 'OnActionExecuted' to add your check logic.
Many thx for EnableQueryAttribute