protected internal virtual async Task ExportIdentityTypesAsync(IDataExportResult result, IEnumerable <Type> types) { if (result == null) { throw new ArgumentNullException(nameof(result)); } await Task.CompletedTask; types = (types ?? Enumerable.Empty <Type>()).ToArray(); if (types.Contains(typeof(UserLoginModel))) { result.Instances.Add(typeof(UserLoginModel), this.IdentityFacade.DatabaseContext.UserLogins.Select(userLogin => new UserLoginModel { Id = userLogin.UserId, Provider = userLogin.LoginProvider, UserIdentifier = userLogin.ProviderKey }).ToArray()); } if (types.Contains(typeof(UserModel))) { var users = this.IdentityFacade.Users.Where(user => user.PasswordHash != null); result.Instances.Add(typeof(UserModel), users.Select(userEntity => new UserModel { Email = userEntity.Email, Id = userEntity.Id, Password = this.DefaultPassword, UserName = userEntity.UserName }).ToArray()); } }
protected internal virtual async Task ExportIdentityProvidersAsync(IDataExportResult result) { if (result == null) { throw new ArgumentNullException(nameof(result)); } await Task.CompletedTask; result.Instances.Add(typeof(IdentityProvider), this.ConfigurationDatabaseContext.IdentityProviders.Select(identityProvider => identityProvider.ToModel())); }
protected internal virtual async Task ExportRelyingPartiesAsync(IDataExportResult result) { if (result == null) { throw new ArgumentNullException(nameof(result)); } await Task.CompletedTask; var relyingParties = this.WsFederationDatabaseContext.RelyingParties .Include(relyingParty => relyingParty.ClaimMapping); result.Instances.Add(typeof(RelyingParty), relyingParties.Select(relyingParty => relyingParty.ToModel())); }
protected internal virtual async Task ExportIdentityResourcesAsync(IDataExportResult result) { if (result == null) { throw new ArgumentNullException(nameof(result)); } await Task.CompletedTask; var identityResources = this.ConfigurationDatabaseContext.IdentityResources .Include(identityResource => identityResource.Properties) .Include(identityResource => identityResource.UserClaims); result.Instances.Add(typeof(IdentityResource), identityResources.Select(identityResource => identityResource.ToModel())); }
protected internal virtual async Task ExportServiceProvidersAsync(IDataExportResult result) { if (result == null) { throw new ArgumentNullException(nameof(result)); } await Task.CompletedTask; var serviceProviders = this.SamlDatabaseContext.ServiceProviders .Include(serviceProvider => serviceProvider.AssertionConsumerServices) .Include(serviceProvider => serviceProvider.ClaimsMapping) .Include(serviceProvider => serviceProvider.SigningCertificates) .Include(serviceProvider => serviceProvider.SingleLogoutServices); result.Instances.Add(typeof(ServiceProvider), serviceProviders.Select(serviceProvider => serviceProvider.ToModel())); }
protected internal virtual async Task ExportIdentityServerPluginTypesAsync(IDataExportResult result, IEnumerable <Type> types) { if (result == null) { throw new ArgumentNullException(nameof(result)); } await Task.CompletedTask; types = (types ?? Enumerable.Empty <Type>()).ToArray(); if (this.FeatureManager.IsEnabled(Feature.Saml) && types.Contains(typeof(ServiceProvider))) { await this.ExportServiceProvidersAsync(result); } if (this.FeatureManager.IsEnabled(Feature.WsFederation) && types.Contains(typeof(RelyingParty))) { await this.ExportRelyingPartiesAsync(result); } }
protected internal virtual async Task ExportClientsAsync(IDataExportResult result) { if (result == null) { throw new ArgumentNullException(nameof(result)); } await Task.CompletedTask; var clients = this.ConfigurationDatabaseContext.Clients .Include(client => client.AllowedCorsOrigins) .Include(client => client.AllowedGrantTypes) .Include(client => client.AllowedScopes) .Include(client => client.Claims) .Include(client => client.ClientSecrets) .Include(client => client.IdentityProviderRestrictions) .Include(client => client.PostLogoutRedirectUris) .Include(client => client.Properties) .Include(client => client.RedirectUris); result.Instances.Add(typeof(Client), clients.Select(client => client.ToModel())); }
protected internal virtual async Task ExportIdentityServerTypesAsync(IDataExportResult result, IEnumerable <Type> types) { if (result == null) { throw new ArgumentNullException(nameof(result)); } await Task.CompletedTask; types = (types ?? Enumerable.Empty <Type>()).ToArray(); if (types.Contains(typeof(ApiResource))) { await this.ExportApiResourcesAsync(result); } if (types.Contains(typeof(ApiScope))) { await this.ExportApiScopesAsync(result); } if (types.Contains(typeof(Client))) { await this.ExportClientsAsync(result); } if (types.Contains(typeof(IdentityProvider))) { await this.ExportIdentityProvidersAsync(result); } if (types.Contains(typeof(IdentityResource))) { await this.ExportIdentityResourcesAsync(result); } }