How to call web API under specific user permission?

你说的曾经没有我的故事 提交于 2019-12-02 09:34:17

In the case of executing an API directly, how do I run it under a specific permission?

You can override current session values and call your method inside the using block.

I have put my code inside a using block, but all APIs were fired successfully

Declare your API methods as public virtual as there are some restrictions for AbpAuthorize.

You have two options.

1- You can make those Application Services anonymously accessible. And if you want it to be secure, send an encrypted security token.

2- You didn't mention if your project is MVC or Angular. I assume you have Angular version. You need a bearer token to make authenticated requests. First you have to authenticate user and get a token. Then add this bearer token to every request.

You have to research for using bearer tokens in asp.net core...

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