docs: auth strategy spike (Auth Code + PKCE + Keycloak themes + ASWebAuthenticationSession) #162
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "159-auth-strategy-spike"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Changes
docs/auth-strategy.md: new definitive auth decision record with mermaid sequence diagrams (web + turbo-ios flows), 37signals pattern docs, RFC 9700 rationale, FiPA draft tracking, and implementation ticket listdocs/keycloak-setup.md: resolution note on ROPC section, client table corrected todirect_access_grants_enabled = No, HCL block set tofalse, updated rationale/Phase 5/follow-up ticketsTest Plan
docs/auth-strategy.mdrenders correctly with mermaid diagramsdocs/keycloak-setup.mdresolution note visible at top of ROPC sectionReview Checklist
Related Notes
landscaping-assistant-- the project this work belongs toReview Findings
Fixed: Stale ROPC pre-requisite (keycloak-setup.md line 175)
The "Pre-requisite" subsection under "ROPC Flow Decision" still stated
direct_access_grants_enabled = trueas a requirement, directly contradicting the resolution note added at the top of the same section. Fixed in commit6ec5ea4-- struck through the stale text and pointed todocs/auth-strategy.md.No other issues found
->>/-->>arrows, proper quoting)auth-strategy.mdandkeycloak-setup.mdare consistentdirect_access_grants_enabledis consistentlyfalse/Noacross all sectionsVERDICT: APPROVED
PR #162 Review
DOMAIN REVIEW
Tech stack identified: Documentation only (Markdown with Mermaid diagrams). No code changes. Domain review focuses on: documentation accuracy, factual claims, Mermaid syntax, internal consistency with existing docs, and completeness as a spike deliverable.
docs/auth-strategy.md (new file, 120 lines)
This is a well-structured architectural decision record. Coverage is thorough:
Mermaid diagram syntax review:
sequenceDiagramsyntax. Participants declared, arrows use correct->>/-->>notation. Self-referencingRails->>Rails:is valid Mermaid.Hiddenparticipant andApp->>App:self-calls render correctly. The diagram accurately shows the ASWebAuthenticationSession pattern with cookie bootstrap.Factual claims verification:
redirect_to_webfallback aligns with published draft content. The "expires September 2026" claim is consistent with the standard 6-month IETF draft expiry. Claim appears accurate.Cross-reference consistency:
docs/app-architecture.md(line 282) already states "ROPC was rejected per OAuth 2.1 deprecation and platform SOP" and the auth diagram shows Auth Code + PKCE. The newauth-strategy.mdis consistent.docs/keycloak-setup.mdROPC Flow Validation section already recommended Auth Code + PKCE. The PR updates this section to reflect the production experience (PR #158 tried and reverted), which is additive and consistent.docs/keycloak-setup.md (changes to existing file)
Changes are well-scoped:
direct_access_grants_enabledcolumn changed fromYesto**No**with cross-reference todocs/auth-strategy.mddirect_access_grants_enabled = false(wastrue)All changes are internally consistent. No stale
direct_access_grants_enabled = truerecommendations remain in the diff.One observation on the on-disk keycloak-setup.md (main branch):
Looking at the current main branch file (line 41), the client table already shows
Nofor Direct Access Grants forlandscaping-assistant. However, the diff shows the PR is changing this line -- meaning the PR branch was based on a state where it wasYes. The diff is internally consistent: it changesYesto**No**with a cross-reference. This is correct.However, line 109 on main already shows
direct_access_grants_enabled = falsein the HCL block, and line 131 says "Direct Access Grants disabled." The diff changes line 109 fromtruetofalseand line 131 from an ROPC description to an Auth Code description. This means the PR's base branch had these astrue/ROPC -- which aligns with the narrative that PR #158 changed them and this PR is restoring/updating them. The fact that main already showsfalsesuggests the revert (PR #161) may have already landed, or the PR branch was forked before recent main changes. Either way, the PR's intent is correct and the final state after merge will be consistent.BLOCKERS
None.
This is a docs-only PR with no code changes. The BLOCKER criteria (missing tests for new functionality, unvalidated input, secrets in code, DRY violations in auth paths) do not apply to documentation.
NITS
auth-strategy.md line 7: "There is no standards-compliant way to have an in-app login form that collects credentials today." -- This is slightly imprecise. There is no finalized standards-compliant way. The FiPA draft (discussed later in the doc) is a standards-track approach that exists today in draft form. Consider rewording to "There is no finalized, standards-compliant way..." for precision. Minor.
auth-strategy.md Implementation Tickets item 1: "Revert PR #158 (restore OmniAuth Auth Code flow) -- DONE (emergency revert)" -- If PR #161 is the revert PR, consider citing it here for traceability (e.g., "DONE via PR #161").
auth-strategy.md Implementation Tickets item 4: "Revert terraform PR #106 in pal-e-services" -- Verify this is the correct PR number. The keycloak-setup.md references
pal-e-services#103for the original Terraform change. If #106 is a different PR that enableddirect_access_grants_enabled = true, this is fine, but worth double-checking.keycloak-setup.md Follow-Up Ticket #4: The updated text references "#115, #157" in the header but the body now says "OmniAuth (Auth Code + PKCE) is the correct approach. PR #158 (ROPC) was reverted." Consider also mentioning #159 (this spike) for completeness.
keycloak-setup.md: The Phase 5 update lists
omniauth-openid-connectgem in step 1, but step 2 says "Keycloak handles credential collection via themed login page." Step 2 is aspirational (theme is not implemented yet). Consider adding "(default theme for now, themed login page per Implementation Ticket #2)" to make the current vs future state clear.Merge conflict risk: The keycloak-setup.md diff touches the same lines that may have been modified by the revert PR #161. If #161 has already merged to main, there may be merge conflicts. The Forgejo API reports
mergeable: true, so this appears to be fine currently.SOP COMPLIANCE
159-auth-strategy-spikereferences issue #159PROCESS OBSERVATIONS
VERDICT: APPROVED
PR #162 Review
DOMAIN REVIEW
Tech stack: Documentation (Markdown, Mermaid diagrams, OAuth 2.1/OIDC architecture decisions)
Technical accuracy assessment:
RFC 9700 claims -- CORRECT. RFC 9700 (OAuth 2.1) Section 2.4 does use MUST NOT language regarding ROPC. The doc accurately states this.
Mermaid diagram (Web Browser Flow) -- CORRECT. The sequence is accurate for Authorization Code + PKCE with a confidential client: browser redirect to Keycloak, user authenticates on Keycloak page, auth code returned via redirect, Rails server exchanges code for tokens. One note: the diagram correctly shows the server-side exchange (Rails->KC), which is correct for a confidential client. PKCE is defense-in-depth here, not the primary client authentication mechanism (the client secret is).
Mermaid diagram (turbo-ios Flow) -- MOSTLY CORRECT. The flow shows ASWebAuthenticationSession for native OAuth, then a cookie bootstrap via hidden WKWebView. This matches the 37signals pattern documented in turbo-ios. Minor technical observation: the diagram shows "App->KC: Exchange code for OAuth token" happening from the app directly. With ASWebAuthenticationSession, the code exchange typically happens within the session context, but the conceptual flow is correct for documentation purposes.
FiPA draft reference -- CORRECT. The "OAuth 2.0 for First-Party Applications" draft (draft-ietf-oauth-first-party-apps) is a real IETF draft that defines an Authorization Challenge Endpoint. The characterization as "not finalized, Keycloak has not implemented it" is accurate.
Consistency between docs -- The
auth-strategy.mdandkeycloak-setup.mdchanges are fully consistent. Both point to Auth Code + PKCE as the correct flow, both reference each other, both state ROPC is prohibited.Terraform cross-reference -- The current
mainbranch at/home/ldraney/landscaping-assistant/docs/keycloak-setup.mdline 109 already showsdirect_access_grants_enabled = falsein the HCL block, and line 41 shows "No" in the client table. The PR's changes align with the actual terraform state.BLOCKERS
1. MERGE CONFLICT (
mergeable: false)The PR reports
mergeable: false. The diff shows changes todocs/keycloak-setup.mdthat modify lines from a pre-revert state (e.g., changingdirect_access_grants_enabled = truetofalsein the HCL, changing "Yes" to "No" in the client table, changing the "Direct Access Grants enabled" rationale bullet). However, the currentmainalready has these lines in their corrected state (likely from PR #161 revert or another commit).This means:
false(line 109) -- same conflictThe PR must be rebased onto current
mainto resolve these conflicts before merge.The
docs/auth-strategy.mdfile is new and has no conflicts -- it can be kept as-is. Thekeycloak-setup.mdchanges need reconciliation: many of the "corrections" this PR makes have already been applied to main, so the rebase will need to determine which changes are truly additive (the resolution note, the strikethrough on the ROPC Decision heading, the updated follow-up ticket #4 text referencing PR #158).NITS
Implementation Ticket #4 reference: "Revert terraform PR #106 in pal-e-services (set
direct_access_grants_enabled = false)" -- verify this PR number is correct. The keycloak-setup.md references pal-e-services#103 as the original terraform PR. Is #106 the separate PR that enabled direct access grants?Standard flow enabled rationale (keycloak-setup.md diff): The PR changes the old text "kept for future use (admin console, service-to-service)" to... nothing, because it only modifies the "Direct Access Grants" bullet. After rebase, verify the "Standard flow enabled" bullet accurately reflects that this IS the primary auth flow (not "kept for future use").
docs/auth-strategy.mdline 7: "There is no standards-compliant way to have an in-app login form that collects credentials today." -- Technically precise, but could be misread. The FiPA draft section later clarifies the nuance well.turbo-ios diagram: The step "App->KC: Exchange code for OAuth token" could specify "(via back-channel HTTPS)" to distinguish it from the front-channel redirect. Minor clarity improvement.
Follow-up ticket #4 in keycloak-setup.md (diff line): The PR changes it to reference "PR #158 (ROPC) was reverted" but also adds references to #157. Verify #157 was actually the OmniAuth->ROPC migration PR vs a different auth issue.
SOP COMPLIANCE
159-auth-strategy-spikematches issue #159mergeable: false, rebase requiredPROCESS OBSERVATIONS
docs/auth-strategy.mdfile, (b) the resolution note at the top of the ROPC section, (c) the strikethrough formatting on the ROPC decision heading, and (d) minor wording updates to follow-up tickets.VERDICT: NOT APPROVED
The content is technically accurate and well-written, but the PR cannot merge due to
mergeable: false. Rebase onto currentmain, resolve conflicts (most "corrections" to keycloak-setup.md are already on main -- focus on the genuinely new content: resolution note, strikethrough formatting, updated follow-up tickets), then re-request review.