mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.5 KiB
39 lines
1.5 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using Microsoft.AspNetCore.Authentication;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Squidex.Config.Authentication
|
|
{
|
|
public static class AuthenticationServices
|
|
{
|
|
public static void AddSquidexAuthentication(this IServiceCollection services, IConfiguration config)
|
|
{
|
|
var identityOptions = config.GetSection("identity").Get<MyIdentityOptions>() ?? new ();
|
|
|
|
services.AddAuthentication()
|
|
.AddSquidexCookies()
|
|
.AddSquidexExternalGithubAuthentication(identityOptions)
|
|
.AddSquidexExternalGoogleAuthentication(identityOptions)
|
|
.AddSquidexExternalMicrosoftAuthentication(identityOptions)
|
|
.AddSquidexExternalOdic(identityOptions)
|
|
.AddSquidexIdentityServerAuthentication(identityOptions, config);
|
|
}
|
|
|
|
public static AuthenticationBuilder AddSquidexCookies(this AuthenticationBuilder builder)
|
|
{
|
|
builder.Services.ConfigureApplicationCookie(options =>
|
|
{
|
|
options.Cookie.Name = ".sq.auth";
|
|
});
|
|
|
|
return builder.AddCookie();
|
|
}
|
|
}
|
|
}
|
|
|