This article is a mirror article of machine translation, please click here to jump to the original article.

View: 24176|Reply: 1

[.NET Core] asp.net core registers for global Authorize authentication

[Copy link]
Posted on 2019-11-22 10:03:29 | | |
For controllers that require certification, we need to add on[Authroize]We have to add such a feature to each controller, which is too cumbersome.

If there are too many controllers, it is easy to miss them. Microsoft.AspNetCore.Authorization.AuthorizeAttribute

For those who do not require authentication, we can add the anonymous access feature[AllowAnonymous]

For controllers that require certification, we configure the certification filter globally, as follows:

startup.cs Documentation:







Previous:ASP.NET MVC Core 3.0 Partial warning
Next:[remote rejected] master -> master (pre-receive hook declined)
 Landlord| Posted on 2024-4-17 16:30:24 |
ASP.NET Core 8 adds global authentication with the following code:

Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com