Пример #1
0
 public SessionStore(IBucket bucket,
     IDataSerializer<AuthenticationTicket> ticketSerializer,
     ILookupNormalizer lookupNormalizer,
     IOptions<IdentityOptions> options)
 {
     _bucket = bucket;
     _timeout = options.Value.Cookies.ApplicationCookie.ExpireTimeSpan;
     _ticketSerializer = ticketSerializer;
     _lookupNormalizer = lookupNormalizer;
 }
 public ApplicationUserManager(IUserStore <User> store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <User> passwordHasher, IEnumerable <IUserValidator <User> > userValidators, IEnumerable <IPasswordValidator <User> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <User> > logger,
                               IIdentityLocalizer localizer)
     : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
     this.localizer = localizer;
 }
Пример #3
0
 public AppUserManager(IUserStore <ApplicationUser> store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <ApplicationUser> passwordHasher, IEnumerable <IUserValidator <ApplicationUser> > userValidators, IEnumerable <IPasswordValidator <ApplicationUser> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IEnumerable <IUserTokenProvider <ApplicationUser> > tokenProviders, ILogger <UserManager <ApplicationUser> > logger, IHttpContextAccessor contextAccessor) : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, tokenProviders, logger, contextAccessor)
 {
 }
Пример #4
0
 public ApplicationRoleManager(ApplicationRoleStore applicationRoleStore, IEnumerable <IRoleValidator <ApplicationRole> > roleValidators, ILookupNormalizer lookupNormalizer,
                               IdentityErrorDescriber identityErrorDescriber, ILogger <ApplicationRoleManager> logger)
     : base(applicationRoleStore, roleValidators, lookupNormalizer, identityErrorDescriber, logger)
 {
 }
Пример #5
0
 public ApplicationRoleManager(RoleStore <ApplicationRole> store, IEnumerable <IRoleValidator <ApplicationRole> > roleValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, Microsoft.Extensions.Logging.ILogger <RoleManager <ApplicationRole> > logger)
     : base(store, roleValidators, keyNormalizer, errors, logger)
 {
 }
 public IdentityRoleManager(IRoleStore <IdentityRole> store, IEnumerable <IRoleValidator <IdentityRole> > roleValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, ILogger <RoleManager <IdentityRole> > logger, IHttpContextAccessor contextAccessor) : base(store, roleValidators, keyNormalizer, errors, logger, contextAccessor)
 {
 }
Пример #7
0
 public SecteUserManager(SecteUserStore store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <SecteUser> passwordHasher, IEnumerable <IUserValidator <SecteUser> > userValidators, IEnumerable <IPasswordValidator <SecteUser> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <SecteUser> > logger) : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger) // gosh
 {
     SecteUserStore = store;
 }
 public static string ConvertEmailToId(string email, ILookupNormalizer lookupNormalizer)
 {
     return lookupNormalizer.Normalize($"IdentityUser:{email}");
 }
Пример #9
0
 /// <summary>
 /// 初始化类<see cref="UserManager{TUser,TUserClaim,TUserLogin,TUserToken,TIdentitySettings}"/>。
 /// </summary>
 /// <param name="store">用户存储接口。</param>
 /// <param name="optionsAccessor"><see cref="T:Microsoft.AspNetCore.Identity.IdentityOptions" />实例对象。</param>
 /// <param name="passwordHasher">密码加密器接口。</param>
 /// <param name="userValidators">用户验证接口。</param>
 /// <param name="passwordValidators">密码验证接口。</param>
 /// <param name="keyNormalizer">唯一键格式化字符串。</param>
 /// <param name="errors">错误实例。</param>
 /// <param name="serviceProvider">服务提供者接口。</param>
 protected UserManager(IUserStore <TUser> store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <TUser> passwordHasher, IEnumerable <IUserValidator <TUser> > userValidators, IEnumerable <IPasswordValidator <TUser> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider serviceProvider)
     : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, serviceProvider, serviceProvider.GetRequiredService <ILogger <UserManager <TUser> > >())
 {
     _serviceProvider = serviceProvider;
     _store           = store as IUserStoreBase <TUser, TUserClaim, TUserLogin, TUserToken>;
     DbContext        = store as IUserDbContext <TUser, TUserClaim, TUserLogin, TUserToken>;
     //通过配置覆盖代码配置。
     Options = serviceProvider.GetRequiredService <ISettingsManager>().GetSettings <TIdentitySettings>().ToIdentityOptions(optionsAccessor);
 }
 public ApplicationRoleManager(RoleStore roleStore, IEnumerable <IRoleValidator <ApplicationRole> > roleValidators,
                               ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, ILogger <ApplicationRoleManager> logger)
     : base(roleStore, roleValidators, keyNormalizer, errors, logger)
 {
 }
Пример #11
0
 public RoleManager(IRoleStore <TRole> store, ILookupNormalizer keyNormalizer)
 {
     Store = store;
 }
 public static string ConvertSessionKeyToId(this string sessionKey, ILookupNormalizer lookupNormalizer)
 {
     return lookupNormalizer.Normalize($"IdentitySession:{sessionKey}");
 }
 public static string ConvertRoleToId(this IRole user, ILookupNormalizer lookupNormalizer)
 {
     return lookupNormalizer.Normalize($"IdentityRole:{user.RoleId}".ToLower());
 }
 public static string ConvertUserToId(this IUser user, ILookupNormalizer lookupNormalizer) 
 {
     return ConvertEmailToId(user.Username ?? user.Email, lookupNormalizer);
 }
Пример #15
0
 public DoitsuUserIntManager(IUserStore <DoitsuUserInt> store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <DoitsuUserInt> passwordHasher, IEnumerable <IUserValidator <DoitsuUserInt> > userValidators, IEnumerable <IPasswordValidator <DoitsuUserInt> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <DoitsuUserInt> > logger) : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
 }
Пример #16
0
 public RoleManager(IRoleStore <AppRole> store, IEnumerable <IRoleValidator <AppRole> > roleValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, ILogger <RoleManager <AppRole> > logger) : base(store, roleValidators, keyNormalizer, errors, logger)
 {
 }
Пример #17
0
 public OmbiUserManager(IUserStore <OmbiUser> store, IOptions <IdentityOptions> optionsAccessor,
                        IPasswordHasher <OmbiUser> passwordHasher, IEnumerable <IUserValidator <OmbiUser> > userValidators,
                        IEnumerable <IPasswordValidator <OmbiUser> > passwordValidators, ILookupNormalizer keyNormalizer,
                        IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <OmbiUser> > logger, IPlexApi plexApi,
                        IEmbyApi embyApi, ISettingsService <EmbySettings> embySettings, ISettingsService <AuthenticationSettings> auth)
     : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
     _plexApi      = plexApi;
     _embyApi      = embyApi;
     _embySettings = embySettings;
     _authSettings = auth;
 }
Пример #18
0
 public DocumentDbRoleStore(DocumentClient documentClient, IOptions <DocumentDbOptions> options, ILookupNormalizer normalizer)
     : base(documentClient, options, normalizer, options.Value.RoleStoreDocumentCollection ?? options.Value.UserStoreDocumentCollection)
 {
     collectionUri = UriFactory.CreateDocumentCollectionUri(
         this.options.Database,
         this.options.RoleStoreDocumentCollection ?? this.options.UserStoreDocumentCollection);
 }
Пример #19
0
 public AgentManager(AgentStore userStore, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <Agent> passwordHasher, IEnumerable <IUserValidator <Agent> > userValidators, IEnumerable <IPasswordValidator <Agent> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <Agent> > logger, IUnitOfWorkManager unitOfWorkManager, ISettingManager settingManager) : base(userStore, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger, unitOfWorkManager, settingManager)
 {
 }
Пример #20
0
 protected LazyLoading_Tests()
 {
     UserRepository   = ServiceProvider.GetRequiredService <IIdentityUserRepository>();
     RoleRepository   = ServiceProvider.GetRequiredService <IIdentityRoleRepository>();
     LookupNormalizer = ServiceProvider.GetRequiredService <ILookupNormalizer>();
 }
Пример #21
0
 public ApplicationUserManager(UserStore store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <UserDB> passwordHasher, IEnumerable <IUserValidator <UserDB> > userValidators, IEnumerable <IPasswordValidator <UserDB> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <UserDB> > logger, IHttpContextAccessor contextAccessor)
     : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger, contextAccessor)
 {
     if (!optionsAccessor.Value.Tokens.ProviderMap.ContainsKey("DefaultTokenProvider"))
     {
         optionsAccessor.Value.Tokens.ProviderMap.Add("DefaultTokenProvider", new TokenProviderDescriptor(typeof(UserStore)));
     }
 }
Пример #22
0
 public ApplicationUserManager(ApplicationUserStore applicationUserStore, IOptions <IdentityOptions> options,
                               IPasswordHasher <ApplicationUser> passwordHasher, IEnumerable <IUserValidator <ApplicationUser> > userValidators,
                               IEnumerable <IPasswordValidator <ApplicationUser> > passwordValidators, ILookupNormalizer lookupNormalizer, IdentityErrorDescriber identityErrorDescriber,
                               IServiceProvider services, ILogger <ApplicationUserManager> logger) : base(applicationUserStore, options, passwordHasher, userValidators, passwordValidators, lookupNormalizer, identityErrorDescriber, services, logger)
 {
 }
Пример #23
0
 public CustomUserManager(IUserStore <UserModel> store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <UserModel> passwordHasher,
                          IEnumerable <IUserValidator <UserModel> > userValidators, IEnumerable <IPasswordValidator <UserModel> > passwordValidators, ILookupNormalizer keyNormalizer,
                          IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <UserModel> > logger)
     : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
     this.store = (CustomUserStore)store;
 }
Пример #24
0
        public UserStore(IMongoCollection <TUser> userCollection, IRoleStore <TRole> roleStore, ILookupNormalizer normalizer)
        {
            _userCollection = userCollection;
            _roleStore      = roleStore;
            _normalizer     = normalizer;

            EnsureIndex(x => x.NormalizedEmail);
            EnsureIndex(x => x.NormalizedUserName);
        }
Пример #25
0
 public UserByRoleNameIndexProvider(ILookupNormalizer keyNormalizer)
 {
     _keyNormalizer = keyNormalizer;
 }
 public ApplicationUserManger(IUserStore <ApplicationUser> store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <ApplicationUser> passwordHasher, IEnumerable <IUserValidator <ApplicationUser> > userValidators, IEnumerable <IPasswordValidator <ApplicationUser> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <ApplicationUser> > logger) : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
     optionsAccessor.Value.Password.RequiredLength         = 4;
     optionsAccessor.Value.Password.RequireNonAlphanumeric = false;
     optionsAccessor.Value.Password.RequireLowercase       = false;
     optionsAccessor.Value.Password.RequireUppercase       = false;
     optionsAccessor.Value.Password.RequireDigit           = false;
 }
        public ServiceManager(BaseDbContext context, IHttpContextAccessor httpContextAccessor, IMapper mapper, ILookupNormalizer lookupNormalizer)
        {
            serviceContext = new ServiceContext();
            serviceContext.AddItem("baseDbContext", context);
            serviceContext.AddItem("IHttpContextAccessor", httpContextAccessor);
            serviceContext.AddItem("IMapper", mapper);
            serviceContext.AddItem("ILookupNormalizer", lookupNormalizer);

            string userid = "";

            if (httpContextAccessor != null && httpContextAccessor.HttpContext != null && httpContextAccessor.HttpContext.User != null)
            {
                userid = httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.Name);
                if (string.IsNullOrEmpty(userid))
                {
                    userid = httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);
                }
            }
            serviceContext.AddItem("CurrentUserId", userid);

            string token = "";

            if (httpContextAccessor != null && httpContextAccessor.HttpContext != null && httpContextAccessor.HttpContext.Request != null)
            {
                token = httpContextAccessor.HttpContext.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();
                if (string.IsNullOrEmpty(token))
                {
                    token = "";
                }
            }
            serviceContext.AddItem("Token", token);

            repositoryManager = new RepositoryManager(context);
        }
Пример #28
0
 public CustomRoleManager(BMEDDbContext context, IRoleStore <ApplicationRole> store, IEnumerable <IRoleValidator <ApplicationRole> > roleValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, ILogger <RoleManager <ApplicationRole> > logger)
     : base(store, roleValidators, keyNormalizer, errors, logger)
 {
     _context   = context;
     _roleStore = store;
 }
 public RoleStore(IIdentityCassandraContext <TUser, TRole, Guid> databaseContext,
                  ILookupNormalizer normalizer = null, IdentityErrorDescriber describer = null) : base(databaseContext, normalizer, describer)
 {
 }
Пример #30
0
 //
 // Summary:
 //     Constructs a new instance of Microsoft.AspNetCore.Identity.UserManager`1.
 //
 // Parameters:
 //   store:
 //     The persistence store the manager will operate over.
 //
 //   optionsAccessor:
 //     The accessor used to access the Microsoft.AspNetCore.Identity.IdentityOptions.
 //
 //   passwordHasher:
 //     The password hashing implementation to use when saving passwords.
 //
 //   userValidators:
 //     A collection of Microsoft.AspNetCore.Identity.IUserValidator`1 to validate users
 //     against.
 //
 //   passwordValidators:
 //     A collection of Microsoft.AspNetCore.Identity.IPasswordValidator`1 to validate
 //     passwords against.
 //
 //   keyNormalizer:
 //     The Microsoft.AspNetCore.Identity.ILookupNormalizer to use when generating index
 //     keys for users.
 //
 //   errors:
 //     The Microsoft.AspNetCore.Identity.IdentityErrorDescriber used to provider error
 //     messages.
 //
 //   services:
 //     The System.IServiceProvider used to resolve services.
 //
 //   logger:
 //     The logger used to log messages, warnings and errors.
 public ApplicationUserManager(IUserStore <HolidayUser> store, IOptions <Microsoft.AspNetCore.Identity.IdentityOptions> optionsAccessor, IPasswordHasher <HolidayUser> passwordHasher,
                               IEnumerable <IUserValidator <HolidayUser> > userValidators, IEnumerable <IPasswordValidator <HolidayUser> > passwordValidators, ILookupNormalizer keyNormalizer,
                               IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <HolidayUser> > logger)
     : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
 }
Пример #31
0
 /// <summary>
 /// 初始化类<see cref="UserManager"/>。
 /// </summary>
 /// <param name="store">用户存储接口。</param>
 /// <param name="optionsAccessor"><see cref="T:Microsoft.AspNetCore.Identity.IdentityOptions" />实例对象。</param>
 /// <param name="passwordHasher">密码加密器接口。</param>
 /// <param name="userValidators">用户验证接口。</param>
 /// <param name="passwordValidators">密码验证接口。</param>
 /// <param name="keyNormalizer">唯一键格式化字符串。</param>
 /// <param name="errors">错误实例。</param>
 /// <param name="serviceProvider">服务提供者接口。</param>
 public UserManager(IUserStore <User> store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <User> passwordHasher, IEnumerable <IUserValidator <User> > userValidators, IEnumerable <IPasswordValidator <User> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider serviceProvider)
     : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, serviceProvider)
 {
     _directory = serviceProvider.GetRequiredService <IMediaDirectory>();
 }
 public AzureUserStore(TAzureStorageContext context, ILookupNormalizer normalizer)
 {
     this.userTable   = new TableStorageService <TUser>(context, "Users");
     this._normalizer = normalizer;
 }
Пример #33
0
 public SunRoleManager(IRoleStore <Role> store, IEnumerable <IRoleValidator <Role> > roleValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, ILogger <RoleManager <Role> > logger) : base(store, roleValidators, keyNormalizer, errors, logger)
 {
     KeyNormalizer = Normalizer.Singleton;
 }
Пример #34
0
 public IdentityServerUserManager(ApplicationDbContext context, IUserStore <ApplicationUser> store, IOptions <IdentityOptions> optionsAccessor,
                                  IPasswordHasher <ApplicationUser> passwordHasher, IEnumerable <IUserValidator <ApplicationUser> > userValidators,
                                  IEnumerable <IPasswordValidator <ApplicationUser> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors,
                                  IServiceProvider services, ILogger <UserManager <ApplicationUser> > logger)
     : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
     _context = context;
     _options = ((IdentityOptions)optionsAccessor.Value).ClaimsIdentity;
 }
 public AppUserManager(IUserStore <IdentityUser> store, IOptions <IdentityOptions> optionsAccessor,
                       IPasswordHasher <IdentityUser> passwordHasher, IEnumerable <IUserValidator <IdentityUser> > userValidators,
                       IEnumerable <IPasswordValidator <IdentityUser> > passwordValidators, ILookupNormalizer keyNormalizer,
                       IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <IdentityUser> > logger,
                       IConfiguration configuration)
     : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators,
            keyNormalizer, errors, services, logger)
 {
     _configuration = configuration;
 }