public IdentityKeyProvidersRegistry(IConfigurationService configurationService, IIdentityKeyProvider[] identityKeyProviders) { _identityKeyProviders = new Dictionary <string, IIdentityKeyProvider>(); foreach (IIdentityKeyProvider item in identityKeyProviders) { if (!_identityKeyProviders.ContainsKey(item.Name)) { _identityKeyProviders.Add(item.Name, item); } } IIdentityConfiguration identityConfiguration = configurationService.Get <IIdentityConfiguration>(); string currentIdentityKeyProviderName = identityConfiguration?.Provider; if (string.IsNullOrEmpty(currentIdentityKeyProviderName)) { throw new IdentityConfigurationSectionCorruptedException(); } if (!_identityKeyProviders.ContainsKey(currentIdentityKeyProviderName)) { throw new IdentityProviderNotSupportedException(currentIdentityKeyProviderName); } _currentIdentityKeyProvider = _identityKeyProviders[currentIdentityKeyProviderName]; }
public RoleRepository(IIdentityConfiguration identityConfiguration) { Verify.IsNotNull(nameof(identityConfiguration), identityConfiguration); _configuration = identityConfiguration; _collection = new DocumentServer(_configuration.ConnectionString) .GetDatabase(_configuration.DatabaseName) .GetCollection <HeaderDoc <UserRoleDoc> >(_configuration.IdentityRoleCollectionName); _tag = new Tag($"{nameof(RoleRepository)}/{_configuration.DatabaseName}/{_configuration.IdentityRoleCollectionName}"); }
protected internal FederationMetadataHandler(IIdentityConfiguration identityConfiguration) { this.IdentityConfiguration = identityConfiguration ?? throw new ArgumentNullException(nameof(identityConfiguration)); }
public AdministrationRepository(IIdentityConfiguration identityConfiguration) { Verify.IsNotNull(nameof(identityConfiguration), identityConfiguration); Verify.IsNotEmpty(nameof(identityConfiguration.DatabaseName), identityConfiguration.DatabaseName); Verify.IsNotEmpty(nameof(identityConfiguration.IdentityRoleCollectionName), identityConfiguration.IdentityRoleCollectionName); Verify.IsNotEmpty(nameof(identityConfiguration.IdentityUserCollectionName), identityConfiguration.IdentityUserCollectionName); _configuration = identityConfiguration; _documentServer = new DocumentServer(_configuration.ConnectionString); _models = new CollectionModel[] { new CollectionModel { CollectionName = identityConfiguration.IdentityRoleCollectionName, Indexes = new CollectionIndex[] { new CollectionIndex { Name = $"{nameof(UserRoleDoc.RoleId)}_index", Unique = true, Keys = new IndexKey[] { new IndexKey { FieldName = HeaderDoc.FieldName(nameof(UserRoleDoc.RoleId)), Descending = false }, } } } }, new CollectionModel { CollectionName = identityConfiguration.IdentityUserCollectionName, Indexes = new CollectionIndex[] { new CollectionIndex { Name = $"{nameof(UserDoc.NormalizedEmail)}_index", Unique = false, Keys = new IndexKey[] { new IndexKey { FieldName = HeaderDoc.FieldName(nameof(UserDoc.NormalizedEmail)), Descending = false }, } }, new CollectionIndex { Name = $"{nameof(UserDoc.NormalizedUserName)}_index", Unique = true, Keys = new IndexKey[] { new IndexKey { FieldName = HeaderDoc.FieldName(nameof(UserDoc.NormalizedUserName)), Descending = false }, } } } } }; }