Use new Auth API
This commit is contained in:
parent
38e76d3539
commit
79c17f75cd
16 changed files with 94 additions and 150 deletions
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
|
@ -32,8 +31,6 @@ namespace Website
|
|||
});
|
||||
|
||||
services.AddSingleton(Configuration);
|
||||
services.AddSingleton<IDatabaseProvider, MySQLDatabaseProvider>()
|
||||
.AddSingleton<UserRepository, UserRepository>();
|
||||
|
||||
services.AddHttpClient<IGitApi, GitApi>(client => client.BaseAddress = new Uri(Configuration["gitApiEndpoint"]))
|
||||
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler {ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true});
|
||||
|
@ -41,6 +38,9 @@ namespace Website
|
|||
services.AddHttpClient<IBlogApi, BlogApi>(client => client.BaseAddress = new Uri(Configuration["blogApiEndpoint"]))
|
||||
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler {ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true});
|
||||
|
||||
services.AddHttpClient<IAuthenticationProvider, AuthenticationProvider>(client => client.BaseAddress = new Uri(Configuration["authApiEndpoint"]))
|
||||
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler {ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true});
|
||||
|
||||
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
|
||||
|
||||
services.AddMvc(options => options.EnableEndpointRouting = false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue