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.
44 lines
1.6 KiB
44 lines
1.6 KiB
// ==========================================================================
|
|
// IdentityServices.cs
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex Group
|
|
// All rights reserved.
|
|
// ==========================================================================
|
|
|
|
using Microsoft.AspNetCore.DataProtection;
|
|
using Microsoft.AspNetCore.DataProtection.KeyManagement;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Options;
|
|
using Squidex.Domain.Users;
|
|
using Squidex.Domain.Users.DataProtection.Orleans;
|
|
using Squidex.Shared.Users;
|
|
|
|
namespace Squidex.Config.Identity
|
|
{
|
|
public static class IdentityServices
|
|
{
|
|
public static void AddMyIdentity(this IServiceCollection services)
|
|
{
|
|
services.AddIdentity<IUser, IRole>()
|
|
.AddDefaultTokenProviders();
|
|
}
|
|
|
|
public static void AddMyDataProtectection(this IServiceCollection services, IConfiguration config)
|
|
{
|
|
var dataProtection = services.AddDataProtection().SetApplicationName("Squidex");
|
|
|
|
services.AddSingleton<OrleansXmlRepository>();
|
|
|
|
services.AddSingleton<IConfigureOptions<KeyManagementOptions>>(s =>
|
|
{
|
|
return new ConfigureOptions<KeyManagementOptions>(options =>
|
|
{
|
|
options.XmlRepository = s.GetRequiredService<OrleansXmlRepository>();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|