mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-02 14:23:21 +00:00
25 lines
924 B
C#
25 lines
924 B
C#
|
|
using Data.SeaHavenIndustries;
|
||
|
|
using Microsoft.AspNetCore.Identity;
|
||
|
|
|
||
|
|
namespace Api.SeaHavenIndustries.Infrastructure
|
||
|
|
{
|
||
|
|
public static class IdentityRegistration
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Registers ASP.NET Identity for the API with the shared password policy.
|
||
|
|
/// Program.cs and the behavior tests both compose Identity through this
|
||
|
|
/// method so the rule under test is the rule that runs.
|
||
|
|
/// </summary>
|
||
|
|
public static IdentityBuilder AddSeaHavenIdentity(this IServiceCollection services)
|
||
|
|
{
|
||
|
|
return services.AddIdentity<ApplicationUser, IdentityRole>(options =>
|
||
|
|
{
|
||
|
|
options.User.RequireUniqueEmail = false;
|
||
|
|
IdentityPasswordPolicy.Apply(options.Password);
|
||
|
|
})
|
||
|
|
.AddEntityFrameworkStores<ApplicationDbContext>()
|
||
|
|
.AddDefaultTokenProviders();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|