mirror of https://github.com/abpframework/abp.git
10 changed files with 82 additions and 14 deletions
@ -0,0 +1,21 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<AssemblyName>Volo.Abp.Identity.AspNetCore</AssemblyName> |
|||
<PackageId>Volo.Abp.Identity.AspNetCore</PackageId> |
|||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> |
|||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
|||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
|||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" /> |
|||
<ProjectReference Include="..\Volo.Abp.Identity.Domain\Volo.Abp.Identity.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,38 @@ |
|||
using Microsoft.AspNetCore.Identity; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.Identity.AspNetCore |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpIdentityDomainModule) |
|||
)] |
|||
public class AbpIdentityAspNetCoreModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services |
|||
.GetObject<IdentityBuilder>() |
|||
.AddDefaultTokenProviders() |
|||
.AddSignInManager(); |
|||
|
|||
//(TODO: Extract an extension method like IdentityBuilder.AddAbpSecurityStampValidator())
|
|||
context.Services.AddScoped<AbpSecurityStampValidator>(); |
|||
context.Services.AddScoped(typeof(SecurityStampValidator<IdentityUser>), provider => provider.GetService(typeof(AbpSecurityStampValidator))); |
|||
context.Services.AddScoped(typeof(ISecurityStampValidator), provider => provider.GetService(typeof(AbpSecurityStampValidator))); |
|||
|
|||
var options = context.Services.ExecutePreConfiguredActions(new AbpIdentityAspNetCoreOptions()); |
|||
|
|||
if (options.ConfigureAuthentication) |
|||
{ |
|||
context.Services |
|||
.AddAuthentication(o => |
|||
{ |
|||
o.DefaultScheme = IdentityConstants.ApplicationScheme; |
|||
o.DefaultSignInScheme = IdentityConstants.ExternalScheme; |
|||
}) |
|||
.AddIdentityCookies(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
namespace Volo.Abp.Identity.AspNetCore |
|||
{ |
|||
public class AbpIdentityAspNetCoreOptions |
|||
{ |
|||
/// <summary>
|
|||
/// Default: true.
|
|||
/// </summary>
|
|||
public bool ConfigureAuthentication { get; set; } = true; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue