December 2019
Intermediate to advanced
510 pages
11h 33m
English
The next steps consist of registering dependencies in the dependency injection engine and in using the resulting dependency, for example, the IUserService instance, in the controller layer. Therefore, this section focuses on the Catalog.API and Catalog.Infrastructure projects.
Let's start by defining a new extension method in the Catalog.Infrastructure project, which adds the authentication part:
using System.Text;using Catalog.Domain.Configurations;using Microsoft.AspNetCore.Authentication.JwtBearer;using Microsoft.Extensions.Configuration;using Microsoft.Extensions.DependencyInjection;using Microsoft.IdentityModel.Tokens;namespace Catalog.Infrastructure.Extensions{ public static class AuthenticationExtensions ...