Skip to content

Verify not duplicate subject for invites#44

Merged
einari merged 2 commits intomainfrom
copilot/verify-not-duplicate-subject-for-invites
May 3, 2026
Merged

Verify not duplicate subject for invites#44
einari merged 2 commits intomainfrom
copilot/verify-not-duplicate-subject-for-invites

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 3, 2026

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

  • InviteExchangeResult enum (Success, DuplicateSubject, Failed) to distinguish HTTP 409 from other exchange failures (#issue)
  • SubjectAlreadyExistsUrl property on Invite config — when set, redirects on duplicate subject instead of serving the built-in page (#issue)
  • invitation-subject-already-exists.html well-known error page (HTTP 409) for the duplicate-subject condition (#issue)
  • WellKnownPageNames.InvitationSubjectAlreadyExists constant (#issue)

Changed

  • ExchangeInvite return type changed from bool to InviteExchangeResult; HTTP 409 from the exchange endpoint now maps to DuplicateSubject (#issue)
  • Phase 2 handler short-circuits on DuplicateSubject: redirects to SubjectAlreadyExistsUrl if configured, otherwise serves invitation-subject-already-exists.html with HTTP 409 — next is not called (#issue)
  • Docs updated: invites.md, error-pages.md, well-known-pages.md (#issue)

Copilot AI linked an issue May 3, 2026 that may be closed by this pull request
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
Copilot AI requested a review from einari May 3, 2026 16:54
Copilot finished work on behalf of einari May 3, 2026 16:54
@einari einari marked this pull request as ready for review May 3, 2026 18:23
@einari einari added the minor label May 3, 2026
@einari einari merged commit 593653a into main May 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify not duplicate subject for invites

2 participants