Merged
Conversation
When the exchange endpoint returns HTTP 409 Conflict, the middleware now detects the duplicate-subject condition and either redirects to the configurable `SubjectAlreadyExistsUrl` or serves the new built-in `invitation-subject-already-exists.html` well-known error page (HTTP 409). - Add `InvitationSubjectAlreadyExists` to `WellKnownPageNames` - Add `SubjectAlreadyExistsUrl` property to `Configuration/Invite` - Add `InviteExchangeResult` enum (Success / DuplicateSubject / Failed) - Change `ExchangeInvite` return type from `bool` to `InviteExchangeResult` - Handle `DuplicateSubject` result in `InvokeAsync` Phase 2 - Add `InviteSubjectAlreadyExists` log message - Add built-in `invitation-subject-already-exists.html` page - Add specs for 409 case without and with configured redirect URL - Update invites.md, error-pages.md, well-known-pages.md Agent-Logs-Url: https://github.com/Cratis/AuthProxy/sessions/3868cce9-3d42-4cdb-a101-8026351b6fb3 Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add verification for unique subject in invites
Verify not duplicate subject for invites
May 3, 2026
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.
Phase 2 of the invite flow had no handling for when an authenticated user's subject is already registered. Any non-success response from the exchange endpoint was silently swallowed and the pipeline continued.
Added
InviteExchangeResultenum (Success,DuplicateSubject,Failed) to distinguish HTTP 409 from other exchange failures (#issue)SubjectAlreadyExistsUrlproperty onInviteconfig — when set, redirects on duplicate subject instead of serving the built-in page (#issue)invitation-subject-already-exists.htmlwell-known error page (HTTP 409) for the duplicate-subject condition (#issue)WellKnownPageNames.InvitationSubjectAlreadyExistsconstant (#issue)Changed
ExchangeInvitereturn type changed frombooltoInviteExchangeResult; HTTP 409 from the exchange endpoint now maps toDuplicateSubject(#issue)DuplicateSubject: redirects toSubjectAlreadyExistsUrlif configured, otherwise servesinvitation-subject-already-exists.htmlwith HTTP 409 —nextis not called (#issue)invites.md,error-pages.md,well-known-pages.md(#issue)