Skip to content

[identity] TOTP Service - enhance recipient and channel handling#1108

Merged
cleftheris merged 12 commits into
developfrom
feature/identity/totp-service-extensions
Jul 21, 2026
Merged

[identity] TOTP Service - enhance recipient and channel handling#1108
cleftheris merged 12 commits into
developfrom
feature/identity/totp-service-extensions

Conversation

@travlos

@travlos travlos commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Refactored TOTP recipient logic to support phone number, email, or user ID as identifiers. Enhanced SendAsync and builder pattern to accept new parameters (email, template, data, classification) and support multiple delivery channels (Email, PushNotification, generic). Added recipient resolution and channel validation. Improved XML docs and performed minor cleanup.

Refactored TOTP recipient logic to support phone number, email, or user ID as identifiers. Enhanced SendAsync and builder pattern to accept new parameters (email, template, data, classification) and support multiple delivery channels (Email, PushNotification, generic). Added recipient resolution and channel validation. Improved XML docs and performed minor cleanup.
@travlos
travlos marked this pull request as ready for review July 20, 2026 08:56
@travlos
travlos requested review from cleftheris and Copilot July 20, 2026 08:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the TotpServiceSecurityToken flow to support multiple recipient identifiers (phone number, email, or user ID) and expands message/channel configuration to support Email and PushNotification delivery, aligning the security-token TOTP service with broader multi-channel delivery needs in the Identity features.

Changes:

  • Extended TotpServiceSecurityToken.SendAsync to accept phone/email/userId plus email template, data, and classification, including recipient resolution and channel validation.
  • Updated the security-token parameters builder to support selecting receiver by phone/email/user and selecting additional delivery channels.
  • Adjusted the TOTP modifier logic in TotpServiceBase to be recipient-based rather than phone-number-only.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/Indice.Features.Identity.Server/Totp/TotpHandlers.cs Minor cleanup (removed unused using).
src/Indice.Features.Identity.Core/Totp/TotpServiceSecurityTokenParametersBuilder.cs Builder updates to support email/user recipients, more channels, and extra optional parameters.
src/Indice.Features.Identity.Core/Totp/TotpServiceSecurityToken.cs Core refactor to resolve recipients (incl. userId), validate channels, and send via multiple delivery mechanisms.
src/Indice.Common/Services/TotpServiceBase.cs Updated modifier generation to work with generalized recipient identifiers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Indice.Features.Identity.Core/Totp/TotpServiceSecurityToken.cs Outdated
Comment thread src/Indice.Features.Identity.Core/Totp/TotpServiceSecurityToken.cs
travlos and others added 3 commits July 20, 2026 12:39
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Refactored ValidateChannel for consistent formatting. Fixed a typo in the TOTP verification method (recipiet → recipient). Added logic to resolve and check the User object by userId at the start of the main method.
@cleftheris cleftheris changed the title Refactor TOTP recipient and channel handling [identity] TOTP Endpoint - enhance recipient and channel handling Jul 21, 2026
cleftheris and others added 7 commits July 21, 2026 11:33
Refactored all usages of "emailTemplate" to "template" in TotpServiceSecurityToken, builder classes, and TotpServiceSecurityTokenParameters to generalize template usage beyond email. Updated method parameters, builder methods, and XML docs for consistency. The TOTP cache key now includes the token value, which may impact rate limiting.
Refactored `ValidateChannel` in `TotpServiceSecurityToken` to use an `out` error parameter and return a `bool`, updating all usages. Enhanced `TotpServiceTests` with `.AddEmailServiceNoop()` and a comprehensive set of new tests covering service creation, TOTP code delivery, error handling, rate limiting, developer mode, user resolution, and factory constructor validation.
Removed commented-out code and explanatory comments from TOTP tests for clarity. Updated rate-limiting test to assert IsRateLimited explicitly. Removed redundant comment in TotpServiceFactory null input test.
Comment thread test/Indice.Features.Identity.Tests/TotpServiceTests.cs Fixed
… IDisposable'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

@cleftheris cleftheris left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@cleftheris cleftheris changed the title [identity] TOTP Endpoint - enhance recipient and channel handling [identity] TOTP Service - enhance recipient and channel handling Jul 21, 2026
@cleftheris
cleftheris merged commit f41535d into develop Jul 21, 2026
7 checks passed
@cleftheris
cleftheris deleted the feature/identity/totp-service-extensions branch July 21, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants