[identity] Email domain Blacklist provider for register/create-user#973
Merged
cleftheris merged 27 commits intodevelopfrom Mar 30, 2026
Merged
[identity] Email domain Blacklist provider for register/create-user#973cleftheris merged 27 commits intodevelopfrom
cleftheris merged 27 commits intodevelopfrom
Conversation
added 4 commits
March 24, 2026 19:25
Introduced EmailDomainBlacklistValidator with support for multiple providers (default, config, file-based) to prevent registration with disposable or blacklisted email domains. Added extension methods for easy DI registration and configuration-based enable/disable. Included a comprehensive disposable email domain blocklist file. Validator is now invoked during user registration.
- Introduce EmailBlacklist config section and file-based domain list - Refactor EmailDomainBlacklistValidator and providers for clarity - Enable/disable validator via config; support file/config providers - Always copy disposable_email_blocklist.conf.txt to output - Update Microsoft.Azure.SignalR to 1.33.0 and add Management package
src/Indice.Features.Identity.Core/Extensions/IdentityBuilderExtensions.cs
Fixed
Show fixed
Hide fixed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an email-domain blacklist validation feature into the Identity registration pipeline, aiming to block signups (or updates) using disposable/blocked email domains.
Changes:
- Wires an email-domain blacklist validator into Identity’s
AddIdentityDefaultssetup. - Adds
EmailDomainBlacklistValidator(with config/file-backed blacklist providers). - Adds a large disposable-domain blocklist file and copies it to build output.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Indice.Features.Identity.Server/Extensions/ServiceCollectionExtensions.cs | Enables the new validator in the IdentityServer default Identity setup chain. |
| src/Indice.Features.Identity.Core/Extensions/IdentityBuilderExtensions.cs | Adds the AddEmailDomainBlacklistValidator registration method and provider wiring. |
| src/Indice.Features.Identity.Core/EmailValidation/EmailDomainBlacklistValidator.cs | Implements the validator and provider types (config + file + default). |
| src/Indice.Features.Identity.Core/EmailValidation/disposable_email_blocklist.conf.txt | Adds the domain blacklist data file used for disposable-email blocking. |
| src/Indice.Features.Identity.Core/Indice.Features.Identity.Core.csproj | Ensures the blocklist file is copied to the output directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Indice.Features.Identity.Core/Extensions/IdentityBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/Extensions/IdentityBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/Extensions/IdentityBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/Indice.Features.Identity.Core.csproj
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/EmailValidation/EmailDomainBlacklistValidator.cs
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/EmailValidation/EmailDomainBlacklistValidator.cs
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/Extensions/IdentityBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/Extensions/IdentityBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
…hub.com/indice-co/Indice.Platform into feature/support-blacklist-email-domains
- Introduce EmailBlacklistOptions for flexible blacklist configuration. - Replace old providers with injectable Config/File providers. - Use embedded resource for blacklist file (email_blocklist.conf). - Improve domain extraction and validation logic (RFC-compliant). - Update IdentityBuilderExtensions for new DI/config pattern. - Remove hardcoded file paths and legacy provider code. - Modernize codebase and improve null handling.
src/Indice.Features.Identity.Core/EmailValidation/EmailDomainBlacklistValidator.cs
Fixed
Show fixed
Hide fixed
- Switch blacklist config to comma-separated string in options - Rename provider method to IsDomainBlacklistedAsync - Config provider now uses IOptions<EmailBlacklistOptions> - File provider loads blacklist from embedded resource, not file - Treat null/invalid emails as blacklisted in validator - Remove configKey param from IdentityBuilderExtensions - Embed blacklist file in assembly, remove file I/O - Update tests for new config and embedded resource usage - Clean up code, improve resource handling and test reliability
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Indice.Features.Identity.Core/Extensions/IdentityBuilderExtensions.cs
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/EmailValidation/EmailDomainBlacklistValidator.cs
Outdated
Show resolved
Hide resolved
test/Indice.Features.Identity.Tests/EmailDomainBlacklistValidatorTests.cs
Outdated
Show resolved
Hide resolved
test/Indice.Features.Identity.Tests/EmailDomainBlacklistValidatorTests.cs
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/EmailValidation/EmailDomainBlacklistValidator.cs
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/EmailValidation/EmailDomainBlacklistValidator.cs
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/EmailValidation/EmailDomainBlacklistValidator.cs
Show resolved
Hide resolved
test/Indice.Features.Identity.Tests/EmailDomainBlacklistValidatorTests.cs
Outdated
Show resolved
Hide resolved
src/Indice.Features.Identity.Core/Configuration/EmailBlacklistOptions.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Renamed the email blacklist config section to "IdentityOptions:Email:Blacklist" for clarity and consistency. Improved XML documentation for blacklist providers to clarify configuration usage and correct file references. Removed unused using directives from IdentityBuilderExtensions.cs.
…hub.com/indice-co/Indice.Platform into feature/support-blacklist-email-domains
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…test Agent-Logs-Url: https://github.com/indice-co/Indice.Platform/sessions/e67ecfea-30ca-4e66-ac66-c27d4cbc531f Co-authored-by: travlos <19430315+travlos@users.noreply.github.com>
…/e67ecfea-30ca-4e66-ac66-c27d4cbc531f Co-authored-by: travlos <19430315+travlos@users.noreply.github.com>
Renamed EmailBlacklistOptions properties for consistency: - Changed section name to "IdentityOptions:EmailBlacklist" - Renamed EnableDomainBlacklist to Enabled - Renamed Domain to Domains (comma-separated list) Updated all references and documentation to use new names.
Changed EmailBlacklistOptions.Name to "EmailBlacklist" for a simpler config section name. Updated IdentityBuilderExtensions to load EmailBlacklistOptions properties individually using GetIdentityOption<T>(), improving clarity and flexibility in configuration binding.
Renamed 'Domain' to 'Domains' in unit tests to match property changes in EmailBlacklistOptions. Commented out <VersionSuffix>rc02</VersionSuffix> in Directory.Build.props to disable the RC version suffix during builds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TryGetDomainmethod inEmailDomainBlacklistValidator.cs(last commit broke method signature with incorrect autofix)ValidateAsync_WithCancellation_StillValidatesEmailtest that didn't actually test cancellation behavior (sinceValidateAsynchas noCancellationTokenparameter)🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.