Last post Jul 22, 2019 07:35 AM by Sherry Chen
Jul 21, 2019 12:34 PM|SamML|LINK
I have found if I try to bring AddAuthorization to an external assembly it was not capable to find reference.
When I go deeper I find another method AddAuthorizationCore.
In my scenario if I create a web project net core 3.0 based with basic Identity accounts he creates the snippet using AddAuthorization. From namespace Microsoft.AspNetCore.Authorization.
But If I create a library assembly and reference to same namespace it does not find the method and suggest me to use AddAuthorizationCore instead.
Should we use AddAuthorizationCore? Why it is not capable to find reference if I am using the same namespace?Thanks in advance :)
Jul 21, 2019 01:08 PM|SamML|LINK
Solved adding manually reference to Microsoft.AspNetCore.Authorization.Policy
But If someone wants answer about differences between AddAuthorization and AddAuthorizationCore and what we should use.
Jul 22, 2019 07:35 AM|Sherry Chen|LINK
Hi SamML ,
AddAuthorization which adds authentication services to the specified
IServiceCollection is the method of AuthenticationServiceCollectionExtensions Class that is for setting up authentication services in an IServiceCollection .
AddAuthorizationCore which adds core authentication services
needed for IAuthenticationService . is the method of AuthenticationCoreServiceCollectionExtensions
Class that is also for setting up authentication services in an IServiceCollection .
For difference between AddAuthorization and AddAuthorizationCore , you could check the source code of them from the below links :
Best Regards ,