Answered by:
.net core windows authentication with username

Question
-
User-1471881183 posted
hello all,
i have asp.net core web application with .net 5. mentioned that its windows authentication in launchsettings.json
now, my doubt its, i wish to grant permission to few users only so, may i know how do i configure few usernames only?
thank you
Wednesday, May 12, 2021 12:57 PM
Answers
-
User-474980206 posted
See this thread
https://stackoverflow.com/questions/53524466/asp-net-core-authorization-using-windows-authentication
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, May 12, 2021 2:33 PM -
User287926715 posted
Hi winseealn,
You can use the Role-based authorization method to access different controllers for roles with different permissions.
Demo:
[Authorize(Roles = "Administrator")] public class AdministrationController : Controller { }
In this way, only users who are members of the Administrator role can access the AdministrationController to perform any operations.
For more operations, please refer to Role-based authorization in ASP.NET Core.
Best Regards,
ChaoDeng
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, May 13, 2021 6:23 AM
All replies
-
User-474980206 posted
See this thread
https://stackoverflow.com/questions/53524466/asp-net-core-authorization-using-windows-authentication
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, May 12, 2021 2:33 PM -
User287926715 posted
Hi winseealn,
You can use the Role-based authorization method to access different controllers for roles with different permissions.
Demo:
[Authorize(Roles = "Administrator")] public class AdministrationController : Controller { }
In this way, only users who are members of the Administrator role can access the AdministrationController to perform any operations.
For more operations, please refer to Role-based authorization in ASP.NET Core.
Best Regards,
ChaoDeng
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, May 13, 2021 6:23 AM