This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
Add a helper extension for setting up JWT bearer authentication #1213
Closed
Description
To setup JWT bearer authentication you have to: 1. add JWT bearer, 2. setup the default auth schemes. We should add a helper extension that does this for you:
The templates currently have this code that should be in the framework:
public static IServiceCollection AddWebApiAuthentication(this IServiceCollection services)
{
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
});
services.AddJwtBearerAuthentication();
return services;
}
Alternative names: AddDefaultJwtBearerAuthentication
, ...