Browse Source

Fixed #130: Replace SecurityStampValidator to override ValidateAsync and make UOW.

pull/138/head
Halil İbrahim Kalkan 9 years ago
parent
commit
8c3bcf0fcb
  1. 8
      src/Volo.Abp.Identity.Domain/Microsoft/Extensions/DependencyInjection/AbpIdentityServiceCollectionExtensions.cs
  2. 29
      src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpSecurityStampValidator.cs

8
src/Volo.Abp.Identity.Domain/Microsoft/Extensions/DependencyInjection/AbpIdentityServiceCollectionExtensions.cs

@ -24,10 +24,10 @@ namespace Microsoft.Extensions.DependencyInjection
services.TryAddScoped<IdentityUserManager>();
services.TryAddScoped(typeof(UserManager<IdentityUser>), provider => provider.GetService(typeof(IdentityUserManager)));
//AbpSecurityStampValidator TODO: We may need to add this in order to ValidateAsync principal!
//services.TryAddScoped<AbpSecurityStampValidator<TTenant, TRole, TUser>>();
//services.TryAddScoped(typeof(SecurityStampValidator<TUser>), provider => provider.GetService(typeof(AbpSecurityStampValidator<TTenant, TRole, TUser>)));
//services.TryAddScoped(typeof(ISecurityStampValidator), provider => provider.GetService(typeof(AbpSecurityStampValidator<TTenant, TRole, TUser>)));
//AbpSecurityStampValidator
services.TryAddScoped<AbpSecurityStampValidator>();
services.TryAddScoped(typeof(SecurityStampValidator<IdentityUser>), provider => provider.GetService(typeof(AbpSecurityStampValidator)));
services.TryAddScoped(typeof(ISecurityStampValidator), provider => provider.GetService(typeof(AbpSecurityStampValidator)));
//AbpUserStore
services.TryAddScoped<IdentityUserStore>();

29
src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpSecurityStampValidator.cs

@ -0,0 +1,29 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Volo.Abp.Uow;
namespace Volo.Abp.Identity
{
public class AbpSecurityStampValidator : SecurityStampValidator<IdentityUser>
{
public AbpSecurityStampValidator(
IOptions<SecurityStampValidatorOptions> options,
SignInManager<IdentityUser> signInManager,
ISystemClock systemClock)
: base(
options,
signInManager,
systemClock)
{
}
[UnitOfWork]
public override Task ValidateAsync(CookieValidatePrincipalContext context)
{
return base.ValidateAsync(context);
}
}
}
Loading…
Cancel
Save