I am using IdentityServer4 to create the Identity server, and I have a MVC project that uses identity server security but I also expose an API in this same MVC project and not separated, I have read and followed the indications of the Switching to Hybrid Flow and adding API Access back but I have not got it. What I need is to have a MVC client and an Api working together on the same project both protected with the security of the identity project. Is this possible?.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Yes we can use for security resign That you can observe .Other methods also there
See https://github.com/auth0-samples/aspnet-core-mvc-plus-webapi for an example of how to configure your ASP.NET MVC application.
Essentially, it boils down to:
AuthenticationScheme
when using the[Authorize]
attribute on your controllers/actions. When you want to use the cookie authentication, you will probably want to useAuthenticationScheme = CookieAuthenticationDefaults.AuthenticationScheme
, and when you want to use the access token, you would probably want to specifyAuthenticationScheme = JwtBearerDefaults.AuthenticationScheme