Updated with secure cooke
This commit is contained in:
parent
cb43207502
commit
fd79027b37
@ -65,7 +65,7 @@ namespace Todo.Api
|
|||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseCors();
|
app.UseCors();
|
||||||
|
app.UseInfrastructure();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||||
@ -19,6 +20,7 @@ public static class DependencyInjection
|
|||||||
.Bind(giteaOptions)
|
.Bind(giteaOptions)
|
||||||
.ValidateDataAnnotations();
|
.ValidateDataAnnotations();
|
||||||
|
|
||||||
|
|
||||||
return services.AddAuthentication(options =>
|
return services.AddAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.DefaultScheme = "Cookies";
|
options.DefaultScheme = "Cookies";
|
||||||
@ -36,7 +38,11 @@ public static class DependencyInjection
|
|||||||
}).Services;
|
}).Services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IApplicationBuilder UseInfrastructure(this IApplicationBuilder app) => app;
|
public static IApplicationBuilder UseInfrastructure(this IApplicationBuilder app) => app.UseCookiePolicy(
|
||||||
|
new CookiePolicyOptions
|
||||||
|
{
|
||||||
|
Secure = CookieSecurePolicy.Always
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GiteaAuthOptions
|
public class GiteaAuthOptions
|
||||||
|
Loading…
Reference in New Issue
Block a user