public AuthenticationManager(UserManager <IdentityUser> userManager, SignInManager <IdentityUser> signInManager, DaprClient daprClient, IConfiguration configuration, TokenValidationParameters validationParameters, FarmerzonAuthenticationContext context) { UserManager = userManager; SignInManager = signInManager; DaprClient = daprClient; Configuration = configuration; ValidationParameters = validationParameters; Context = context; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, FarmerzonAuthenticationContext context) { // Enable middleware to serve generated Swagger as a JSON endpoint. app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), // specifying the Swagger JSON endpoint. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Farmerzon Authentication API V1"); }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseMiddleware(typeof(ErrorHandlingMiddleware)); } app.UseRouting(); app.UseCors(CorsPolicy); app.UseCloudEvents(); // It is important to use app.UseAuthentication(); before app.UseAuthorization(); // Otherwise authentication with json web tokens doesn't work. app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapSubscribeHandler(); endpoints.MapHealthChecks("/health/startup"); endpoints.MapHealthChecks("/healthz"); endpoints.MapHealthChecks("/ready"); endpoints.MapControllers(); }); context.Database.Migrate(); }
public PersonManager(IMapper mapper, FarmerzonAuthenticationContext context) : base(mapper) { Context = context; }